home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume25 / rcs-5.6 / part03 < prev    next >
Encoding:
Text File  |  1991-12-19  |  79.0 KB  |  2,700 lines

  1. Newsgroups: comp.sources.unix
  2. From: hammer@cs.purdue.edu (Adam Hammer)
  3. Subject: v25i079: rcs-5.6 - Revision Control System, V5.6, Part03/11
  4. Sender: sources-moderator@pa.dec.com
  5. Approved: vixie@pa.dec.com
  6.  
  7. Submitted-By: hammer@cs.purdue.edu (Adam Hammer)
  8. Posting-Number: Volume 25, Issue 79
  9. Archive-Name: rcs-5.6/part03
  10.  
  11. #! /bin/sh
  12. # This is a shell archive.  Remove anything before this line, then unpack
  13. # it by saving it into a file and typing "sh file".  To overwrite existing
  14. # files, type "sh file -c".  You can also feed this as standard input via
  15. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  16. # will see the following message at the end:
  17. #        "End of archive 3 (of 11)."
  18. # Contents:  COPYING man/ci.1 man/co.1 src/conf.heg src/rcsgen.c
  19. # Wrapped by vixie@cognition.pa.dec.com on Fri Dec 20 16:23:40 1991
  20. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  21. if test -f 'COPYING' -a "${1}" != "-c" ; then 
  22.   echo shar: Will not clobber existing file \"'COPYING'\"
  23. else
  24. echo shar: Extracting \"'COPYING'\" \(17982 characters\)
  25. sed "s/^X//" >'COPYING' <<'END_OF_FILE'
  26. X            GNU GENERAL PUBLIC LICENSE
  27. X               Version 2, June 1991
  28. X
  29. X Copyright (C) 1989, 1991 Free Software Foundation, Inc.
  30. X                          675 Mass Ave, Cambridge, MA 02139, USA
  31. X Everyone is permitted to copy and distribute verbatim copies
  32. X of this license document, but changing it is not allowed.
  33. X
  34. X                Preamble
  35. X
  36. X  The licenses for most software are designed to take away your
  37. freedom to share and change it.  By contrast, the GNU General Public
  38. License is intended to guarantee your freedom to share and change free
  39. software--to make sure the software is free for all its users.  This
  40. General Public License applies to most of the Free Software
  41. XFoundation's software and to any other program whose authors commit to
  42. using it.  (Some other Free Software Foundation software is covered by
  43. the GNU Library General Public License instead.)  You can apply it to
  44. your programs, too.
  45. X
  46. X  When we speak of free software, we are referring to freedom, not
  47. price.  Our General Public Licenses are designed to make sure that you
  48. have the freedom to distribute copies of free software (and charge for
  49. this service if you wish), that you receive source code or can get it
  50. if you want it, that you can change the software or use pieces of it
  51. in new free programs; and that you know you can do these things.
  52. X
  53. X  To protect your rights, we need to make restrictions that forbid
  54. anyone to deny you these rights or to ask you to surrender the rights.
  55. These restrictions translate to certain responsibilities for you if you
  56. distribute copies of the software, or if you modify it.
  57. X
  58. X  For example, if you distribute copies of such a program, whether
  59. gratis or for a fee, you must give the recipients all the rights that
  60. you have.  You must make sure that they, too, receive or can get the
  61. source code.  And you must show them these terms so they know their
  62. rights.
  63. X
  64. X  We protect your rights with two steps: (1) copyright the software, and
  65. X(2) offer you this license which gives you legal permission to copy,
  66. distribute and/or modify the software.
  67. X
  68. X  Also, for each author's protection and ours, we want to make certain
  69. that everyone understands that there is no warranty for this free
  70. software.  If the software is modified by someone else and passed on, we
  71. want its recipients to know that what they have is not the original, so
  72. that any problems introduced by others will not reflect on the original
  73. authors' reputations.
  74. X
  75. X  Finally, any free program is threatened constantly by software
  76. patents.  We wish to avoid the danger that redistributors of a free
  77. program will individually obtain patent licenses, in effect making the
  78. program proprietary.  To prevent this, we have made it clear that any
  79. patent must be licensed for everyone's free use or not licensed at all.
  80. X
  81. X  The precise terms and conditions for copying, distribution and
  82. modification follow.
  83. X
  84. X            GNU GENERAL PUBLIC LICENSE
  85. X   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  86. X
  87. X  0. This License applies to any program or other work which contains
  88. a notice placed by the copyright holder saying it may be distributed
  89. under the terms of this General Public License.  The "Program", below,
  90. refers to any such program or work, and a "work based on the Program"
  91. means either the Program or any derivative work under copyright law:
  92. that is to say, a work containing the Program or a portion of it,
  93. either verbatim or with modifications and/or translated into another
  94. language.  (Hereinafter, translation is included without limitation in
  95. the term "modification".)  Each licensee is addressed as "you".
  96. X
  97. Activities other than copying, distribution and modification are not
  98. covered by this License; they are outside its scope.  The act of
  99. running the Program is not restricted, and the output from the Program
  100. is covered only if its contents constitute a work based on the
  101. Program (independent of having been made by running the Program).
  102. Whether that is true depends on what the Program does.
  103. X
  104. X  1. You may copy and distribute verbatim copies of the Program's
  105. source code as you receive it, in any medium, provided that you
  106. conspicuously and appropriately publish on each copy an appropriate
  107. copyright notice and disclaimer of warranty; keep intact all the
  108. notices that refer to this License and to the absence of any warranty;
  109. and give any other recipients of the Program a copy of this License
  110. along with the Program.
  111. X
  112. You may charge a fee for the physical act of transferring a copy, and
  113. you may at your option offer warranty protection in exchange for a fee.
  114. X
  115. X  2. You may modify your copy or copies of the Program or any portion
  116. of it, thus forming a work based on the Program, and copy and
  117. distribute such modifications or work under the terms of Section 1
  118. above, provided that you also meet all of these conditions:
  119. X
  120. X    a) You must cause the modified files to carry prominent notices
  121. X    stating that you changed the files and the date of any change.
  122. X
  123. X    b) You must cause any work that you distribute or publish, that in
  124. X    whole or in part contains or is derived from the Program or any
  125. X    part thereof, to be licensed as a whole at no charge to all third
  126. X    parties under the terms of this License.
  127. X
  128. X    c) If the modified program normally reads commands interactively
  129. X    when run, you must cause it, when started running for such
  130. X    interactive use in the most ordinary way, to print or display an
  131. X    announcement including an appropriate copyright notice and a
  132. X    notice that there is no warranty (or else, saying that you provide
  133. X    a warranty) and that users may redistribute the program under
  134. X    these conditions, and telling the user how to view a copy of this
  135. X    License.  (Exception: if the Program itself is interactive but
  136. X    does not normally print such an announcement, your work based on
  137. X    the Program is not required to print an announcement.)
  138. X
  139. These requirements apply to the modified work as a whole.  If
  140. identifiable sections of that work are not derived from the Program,
  141. and can be reasonably considered independent and separate works in
  142. themselves, then this License, and its terms, do not apply to those
  143. sections when you distribute them as separate works.  But when you
  144. distribute the same sections as part of a whole which is a work based
  145. on the Program, the distribution of the whole must be on the terms of
  146. this License, whose permissions for other licensees extend to the
  147. entire whole, and thus to each and every part regardless of who wrote it.
  148. X
  149. Thus, it is not the intent of this section to claim rights or contest
  150. your rights to work written entirely by you; rather, the intent is to
  151. exercise the right to control the distribution of derivative or
  152. collective works based on the Program.
  153. X
  154. In addition, mere aggregation of another work not based on the Program
  155. with the Program (or with a work based on the Program) on a volume of
  156. a storage or distribution medium does not bring the other work under
  157. the scope of this License.
  158. X
  159. X  3. You may copy and distribute the Program (or a work based on it,
  160. under Section 2) in object code or executable form under the terms of
  161. Sections 1 and 2 above provided that you also do one of the following:
  162. X
  163. X    a) Accompany it with the complete corresponding machine-readable
  164. X    source code, which must be distributed under the terms of Sections
  165. X    1 and 2 above on a medium customarily used for software interchange; or,
  166. X
  167. X    b) Accompany it with a written offer, valid for at least three
  168. X    years, to give any third party, for a charge no more than your
  169. X    cost of physically performing source distribution, a complete
  170. X    machine-readable copy of the corresponding source code, to be
  171. X    distributed under the terms of Sections 1 and 2 above on a medium
  172. X    customarily used for software interchange; or,
  173. X
  174. X    c) Accompany it with the information you received as to the offer
  175. X    to distribute corresponding source code.  (This alternative is
  176. X    allowed only for noncommercial distribution and only if you
  177. X    received the program in object code or executable form with such
  178. X    an offer, in accord with Subsection b above.)
  179. X
  180. The source code for a work means the preferred form of the work for
  181. making modifications to it.  For an executable work, complete source
  182. code means all the source code for all modules it contains, plus any
  183. associated interface definition files, plus the scripts used to
  184. control compilation and installation of the executable.  However, as a
  185. special exception, the source code distributed need not include
  186. anything that is normally distributed (in either source or binary
  187. form) with the major components (compiler, kernel, and so on) of the
  188. operating system on which the executable runs, unless that component
  189. itself accompanies the executable.
  190. X
  191. If distribution of executable or object code is made by offering
  192. access to copy from a designated place, then offering equivalent
  193. access to copy the source code from the same place counts as
  194. distribution of the source code, even though third parties are not
  195. compelled to copy the source along with the object code.
  196. X
  197. X  4. You may not copy, modify, sublicense, or distribute the Program
  198. except as expressly provided under this License.  Any attempt
  199. otherwise to copy, modify, sublicense or distribute the Program is
  200. void, and will automatically terminate your rights under this License.
  201. However, parties who have received copies, or rights, from you under
  202. this License will not have their licenses terminated so long as such
  203. parties remain in full compliance.
  204. X
  205. X  5. You are not required to accept this License, since you have not
  206. signed it.  However, nothing else grants you permission to modify or
  207. distribute the Program or its derivative works.  These actions are
  208. prohibited by law if you do not accept this License.  Therefore, by
  209. modifying or distributing the Program (or any work based on the
  210. Program), you indicate your acceptance of this License to do so, and
  211. all its terms and conditions for copying, distributing or modifying
  212. the Program or works based on it.
  213. X
  214. X  6. Each time you redistribute the Program (or any work based on the
  215. Program), the recipient automatically receives a license from the
  216. original licensor to copy, distribute or modify the Program subject to
  217. these terms and conditions.  You may not impose any further
  218. restrictions on the recipients' exercise of the rights granted herein.
  219. You are not responsible for enforcing compliance by third parties to
  220. this License.
  221. X
  222. X  7. If, as a consequence of a court judgment or allegation of patent
  223. infringement or for any other reason (not limited to patent issues),
  224. conditions are imposed on you (whether by court order, agreement or
  225. otherwise) that contradict the conditions of this License, they do not
  226. excuse you from the conditions of this License.  If you cannot
  227. distribute so as to satisfy simultaneously your obligations under this
  228. License and any other pertinent obligations, then as a consequence you
  229. may not distribute the Program at all.  For example, if a patent
  230. license would not permit royalty-free redistribution of the Program by
  231. all those who receive copies directly or indirectly through you, then
  232. the only way you could satisfy both it and this License would be to
  233. refrain entirely from distribution of the Program.
  234. X
  235. If any portion of this section is held invalid or unenforceable under
  236. any particular circumstance, the balance of the section is intended to
  237. apply and the section as a whole is intended to apply in other
  238. circumstances.
  239. X
  240. It is not the purpose of this section to induce you to infringe any
  241. patents or other property right claims or to contest validity of any
  242. such claims; this section has the sole purpose of protecting the
  243. integrity of the free software distribution system, which is
  244. implemented by public license practices.  Many people have made
  245. generous contributions to the wide range of software distributed
  246. through that system in reliance on consistent application of that
  247. system; it is up to the author/donor to decide if he or she is willing
  248. to distribute software through any other system and a licensee cannot
  249. impose that choice.
  250. X
  251. This section is intended to make thoroughly clear what is believed to
  252. be a consequence of the rest of this License.
  253. X
  254. X  8. If the distribution and/or use of the Program is restricted in
  255. certain countries either by patents or by copyrighted interfaces, the
  256. original copyright holder who places the Program under this License
  257. may add an explicit geographical distribution limitation excluding
  258. those countries, so that distribution is permitted only in or among
  259. countries not thus excluded.  In such case, this License incorporates
  260. the limitation as if written in the body of this License.
  261. X
  262. X  9. The Free Software Foundation may publish revised and/or new versions
  263. of the General Public License from time to time.  Such new versions will
  264. be similar in spirit to the present version, but may differ in detail to
  265. address new problems or concerns.
  266. X
  267. XEach version is given a distinguishing version number.  If the Program
  268. specifies a version number of this License which applies to it and "any
  269. later version", you have the option of following the terms and conditions
  270. either of that version or of any later version published by the Free
  271. Software Foundation.  If the Program does not specify a version number of
  272. this License, you may choose any version ever published by the Free Software
  273. XFoundation.
  274. X
  275. X  10. If you wish to incorporate parts of the Program into other free
  276. programs whose distribution conditions are different, write to the author
  277. to ask for permission.  For software which is copyrighted by the Free
  278. Software Foundation, write to the Free Software Foundation; we sometimes
  279. make exceptions for this.  Our decision will be guided by the two goals
  280. of preserving the free status of all derivatives of our free software and
  281. of promoting the sharing and reuse of software generally.
  282. X
  283. X                NO WARRANTY
  284. X
  285. X  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
  286. XFOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
  287. OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
  288. PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
  289. OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  290. MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
  291. TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
  292. PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
  293. REPAIR OR CORRECTION.
  294. X
  295. X  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
  296. WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
  297. REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
  298. INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
  299. OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
  300. TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
  301. YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
  302. PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
  303. POSSIBILITY OF SUCH DAMAGES.
  304. X
  305. X             END OF TERMS AND CONDITIONS
  306. X
  307. X    Appendix: How to Apply These Terms to Your New Programs
  308. X
  309. X  If you develop a new program, and you want it to be of the greatest
  310. possible use to the public, the best way to achieve this is to make it
  311. free software which everyone can redistribute and change under these terms.
  312. X
  313. X  To do so, attach the following notices to the program.  It is safest
  314. to attach them to the start of each source file to most effectively
  315. convey the exclusion of warranty; and each file should have at least
  316. the "copyright" line and a pointer to where the full notice is found.
  317. X
  318. X    <one line to give the program's name and a brief idea of what it does.>
  319. X    Copyright (C) 19yy  <name of author>
  320. X
  321. X    This program is free software; you can redistribute it and/or modify
  322. X    it under the terms of the GNU General Public License as published by
  323. X    the Free Software Foundation; either version 2 of the License, or
  324. X    (at your option) any later version.
  325. X
  326. X    This program is distributed in the hope that it will be useful,
  327. X    but WITHOUT ANY WARRANTY; without even the implied warranty of
  328. X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  329. X    GNU General Public License for more details.
  330. X
  331. X    You should have received a copy of the GNU General Public License
  332. X    along with this program; if not, write to the Free Software
  333. X    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  334. X
  335. Also add information on how to contact you by electronic and paper mail.
  336. X
  337. If the program is interactive, make it output a short notice like this
  338. when it starts in an interactive mode:
  339. X
  340. X    Gnomovision version 69, Copyright (C) 19yy name of author
  341. X    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
  342. X    This is free software, and you are welcome to redistribute it
  343. X    under certain conditions; type `show c' for details.
  344. X
  345. The hypothetical commands `show w' and `show c' should show the appropriate
  346. parts of the General Public License.  Of course, the commands you use may
  347. be called something other than `show w' and `show c'; they could even be
  348. mouse-clicks or menu items--whatever suits your program.
  349. X
  350. You should also get your employer (if you work as a programmer) or your
  351. school, if any, to sign a "copyright disclaimer" for the program, if
  352. necessary.  Here is a sample; alter the names:
  353. X
  354. X  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  355. X  `Gnomovision' (which makes passes at compilers) written by James Hacker.
  356. X
  357. X  <signature of Ty Coon>, 1 April 1989
  358. X  Ty Coon, President of Vice
  359. X
  360. This General Public License does not permit incorporating your program into
  361. proprietary programs.  If your program is a subroutine library, you may
  362. consider it more useful to permit linking proprietary applications with the
  363. library.  If this is what you want to do, use the GNU Library General
  364. Public License instead of this License.
  365. END_OF_FILE
  366. if test 17982 -ne `wc -c <'COPYING'`; then
  367.     echo shar: \"'COPYING'\" unpacked with wrong size!
  368. fi
  369. # end of 'COPYING'
  370. fi
  371. if test -f 'man/ci.1' -a "${1}" != "-c" ; then 
  372.   echo shar: Will not clobber existing file \"'man/ci.1'\"
  373. else
  374. echo shar: Extracting \"'man/ci.1'\" \(17938 characters\)
  375. sed "s/^X//" >'man/ci.1' <<'END_OF_FILE'
  376. X.de Id
  377. X.ds Rv \\$3
  378. X.ds Dt \\$4
  379. X..
  380. X.Id $Id: ci.1,v 5.9 1991/10/07 17:32:46 eggert Exp $
  381. X.ds r \&\s-1RCS\s0
  382. X.if n .ds - \%--
  383. X.if t .ds - \(em
  384. X.TH CI 1 \*(Dt GNU
  385. X.SH NAME
  386. ci \- check in RCS revisions
  387. X.SH SYNOPSIS
  388. X.B ci
  389. X.RI [ options ] " file " .\|.\|.
  390. X.SH DESCRIPTION
  391. X.B ci
  392. stores new revisions into \*r files.
  393. XEach pathname matching an \*r suffix
  394. is taken to be an \*r file.
  395. All others
  396. are assumed to be working files containing new revisions.
  397. X.B ci
  398. deposits the contents of each working file
  399. into the corresponding \*r file.
  400. If only a working file is given,
  401. X.B ci
  402. tries to find the corresponding \*r file in an \*r subdirectory
  403. and then in the working file's directory.
  404. XFor more details, see
  405. X.SM "FILE NAMING"
  406. below.
  407. X.PP
  408. XFor
  409. X.B ci
  410. to work, the caller's login must be on the access list,
  411. except if the access list is empty or the caller is the superuser or the
  412. owner of the file.
  413. To append a new revision to an existing branch, the tip revision on
  414. that branch must be locked by the caller.  Otherwise, only a
  415. new branch can be created.  This restriction is not enforced
  416. for the owner of the file if non-strict locking is used
  417. X(see
  418. X.BR rcs (1)).
  419. A lock held by someone else may be broken with the
  420. X.B rcs
  421. command.
  422. X.PP
  423. Unless the
  424. X.B \-f
  425. option is given,
  426. X.B ci
  427. checks whether the revision to be deposited differs from the preceding one.
  428. If not, instead of creating a new revision
  429. X.B ci
  430. reverts to the preceding one.
  431. To revert, ordinary
  432. X.B ci
  433. removes the working file and any lock;
  434. X.B "ci\ \-l"
  435. keeps and
  436. X.B "ci\ \-u"
  437. removes any lock, and then they both generate a new working file much as if
  438. X.B "co\ \-l"
  439. or
  440. X.B "co\ \-u"
  441. had been applied to the preceding revision.
  442. When reverting, any
  443. X.B \-n
  444. and
  445. X.B \-s
  446. options apply to the preceding revision.
  447. X.PP
  448. XFor each revision deposited,
  449. X.B ci
  450. prompts for a log message.
  451. The log message should summarize the change and must be terminated by
  452. end-of-file or by a line containing
  453. X.BR \&. "\ by"
  454. itself.
  455. If several files are checked in
  456. X.B ci
  457. asks whether to reuse the
  458. previous log message.
  459. If the standard input is not a terminal,
  460. X.B ci
  461. suppresses the prompt
  462. and uses the same log message for all files.
  463. See also
  464. X.BR \-m .
  465. X.PP
  466. If the \*r file does not exist,
  467. X.B ci
  468. creates it and
  469. deposits the contents of the working file as the initial revision
  470. X(default number:
  471. X.BR 1.1 ).
  472. The access list is initialized to empty.
  473. Instead of the log message,
  474. X.B ci
  475. requests descriptive text (see
  476. X.B \-t
  477. below).
  478. X.PP
  479. The number
  480. X.I rev
  481. of the deposited revision can be given by any of the options
  482. X.BR \-f ,
  483. X.BR \-I ,
  484. X.BR \-k ,
  485. X.BR \-l ,
  486. X.BR \-M ,
  487. X.BR \-q ,
  488. X.BR \-r ,
  489. or
  490. X.BR \-u .
  491. X.I rev
  492. may be symbolic, numeric, or mixed.
  493. If
  494. X.I rev
  495. is
  496. X.BR $ ,
  497. X.B ci
  498. determines the revision number from keyword values in the working file.
  499. X.PP
  500. If
  501. X.I rev
  502. is a revision number, it must be higher than the latest
  503. one on the branch to which
  504. X.I rev
  505. belongs, or must start a new branch.
  506. X.PP
  507. If
  508. X.I rev
  509. is a branch rather than a revision number,
  510. the new revision is appended to that branch.  The level number is obtained
  511. by incrementing the tip revision number of that branch.
  512. If
  513. X.I rev
  514. indicates a non-existing branch,
  515. that branch is created with the initial revision numbered
  516. X.IB rev .1\f1.\fP
  517. X.br
  518. X.ne 8
  519. X.PP
  520. If
  521. X.I rev
  522. is omitted,
  523. X.B ci
  524. tries to derive the new revision number from
  525. the caller's last lock.  If the caller has locked the tip revision of a branch,
  526. the new revision is appended to that branch.
  527. The new revision number is obtained
  528. by incrementing the tip revision number.
  529. If the caller locked a non-tip revision, a new branch is started at
  530. that revision by incrementing the highest branch number at that revision.
  531. The default initial branch and level numbers are
  532. X.BR 1 .
  533. X.PP
  534. If
  535. X.I rev
  536. is omitted and the caller has no lock, but owns
  537. the file and locking
  538. is not set to
  539. X.IR strict ,
  540. then the revision is appended to the
  541. default branch (normally the trunk; see the
  542. X.B \-b
  543. option of
  544. X.BR rcs (1)).
  545. X.PP
  546. XException: On the trunk, revisions can be appended to the end, but
  547. not inserted.
  548. X.SH OPTIONS
  549. X.TP
  550. X.BR \-r [\f2rev\fP]
  551. checks in a revision, releases the corresponding lock, and
  552. removes the working file.  This is the default.
  553. X.RS
  554. X.PP
  555. The
  556. X.B \-r
  557. option has an unusual meaning in
  558. X.BR ci .
  559. In other \*r commands,
  560. X.B \-r
  561. merely specifies a revision number,
  562. but in
  563. X.B ci
  564. it also releases a lock and removes the working file.
  565. See
  566. X.B \-u
  567. for a tricky example.
  568. X.RE
  569. X.TP
  570. X.BR \-l [\f2rev\fP]
  571. works like
  572. X.BR \-r ,
  573. except it performs an additional
  574. X.B "co\ \-l"
  575. for the
  576. deposited revision.  Thus, the deposited revision is immediately
  577. checked out again and locked.
  578. This is useful for saving a revision although one wants to continue
  579. editing it after the checkin.
  580. X.TP
  581. X.BR \-u [\f2rev\fP]
  582. works like
  583. X.BR \-l ,
  584. except that the deposited revision is not locked.
  585. This lets one read the working file
  586. immediately after checkin.
  587. X.RS
  588. X.PP
  589. The
  590. X.BR \-l ,
  591. X.BR \-r ,
  592. and
  593. X.B \-u
  594. options are mutually exclusive and silently override each other.
  595. XFor example,
  596. X.B "ci\ \-u\ \-r"
  597. is equivalent to
  598. X.B "ci\ \-r"
  599. because
  600. X.B \-r
  601. overrides
  602. X.BR \-u .
  603. X.RE
  604. X.TP
  605. X.BR \-f [\f2rev\fP]
  606. forces a deposit; the new revision is deposited even it is not different
  607. from the preceding one.
  608. X.TP
  609. X.BR \-k [\f2rev\fP]
  610. searches the working file for keyword values to determine its revision number,
  611. creation date, state, and author (see
  612. X.BR co (1)),
  613. and assigns these
  614. values to the deposited revision, rather than computing them locally.
  615. It also generates a default login message noting the login of the caller
  616. and the actual checkin date.
  617. This option is useful for software distribution.  A revision that is sent to
  618. several sites should be checked in with the
  619. X.B \-k
  620. option at these sites to
  621. preserve the original number, date, author, and state.
  622. The extracted keyword values and the default log message may be overridden
  623. with the options
  624. X.BR \-d ,
  625. X.BR \-m ,
  626. X.BR \-s ,
  627. X.BR \-w ,
  628. and any option that carries a revision number.
  629. X.TP
  630. X.BR \-q [\f2rev\fP]
  631. quiet mode; diagnostic output is not printed.
  632. A revision that is not different from the preceding one is not deposited,
  633. unless
  634. X.B \-f
  635. is given.
  636. X.TP
  637. X.BR \-I [\f2rev\fP]
  638. interactive mode;
  639. the user is prompted and questioned
  640. even if the standard input is not a terminal.
  641. X.TP
  642. X.BR \-d "[\f2date\fP]"
  643. uses
  644. X.I date
  645. for the checkin date and time.
  646. The
  647. X.I date
  648. is specified in free format as explained in
  649. X.BR co (1).
  650. This is useful for lying about the checkin date, and for
  651. X.B \-k
  652. if no date is available.
  653. If
  654. X.I date
  655. is empty, the working file's time of last modification is used.
  656. X.TP
  657. X.BR \-M [\f2rev\fP]
  658. Set the modification time on any new working file
  659. to be the date of the retrieved revision.
  660. XFor example,
  661. X.BI "ci\ \-d\ \-M\ \-u" "\ f"
  662. does not alter
  663. X.IR f 's
  664. modification time, even if
  665. X.IR f 's
  666. contents change due to keyword substitution.
  667. Use this option with care; it can confuse
  668. X.BR make (1).
  669. X.TP
  670. X.BI \-m "msg"
  671. uses the string
  672. X.I msg
  673. as the log message for all revisions checked in.
  674. X.TP
  675. X.BI \-n "name"
  676. assigns the symbolic name
  677. X.I name
  678. to the number of the checked-in revision.
  679. X.B ci
  680. prints an error message if
  681. X.I name
  682. is already assigned to another
  683. number.
  684. X.TP
  685. X.BI \-N "name"
  686. same as
  687. X.BR \-n ,
  688. except that it overrides a previous assignment of
  689. X.IR name .
  690. X.TP
  691. X.BI \-s "state"
  692. sets the state of the checked-in revision to the identifier
  693. X.IR state .
  694. The default state is
  695. X.BR Exp .
  696. X.TP
  697. X.BI \-t file
  698. writes descriptive text from the contents of the named
  699. X.I file
  700. into the \*r file,
  701. deleting the existing text.
  702. The
  703. X.I file
  704. may not begin with
  705. X.BR \- .
  706. X.TP
  707. X.BI \-t\- string
  708. Write descriptive text from the
  709. X.I string
  710. into the \*r file, deleting the existing text.
  711. X.RS
  712. X.PP
  713. The
  714. X.B \-t
  715. option, in both its forms, has effect only during an initial checkin;
  716. it is silently ignored otherwise.
  717. X.PP
  718. During the initial checkin, if
  719. X.B \-t
  720. is not given,
  721. X.B ci
  722. obtains the text from standard input,
  723. terminated by end-of-file or by a line containing
  724. X.BR \&. "\ by"
  725. itself.
  726. The user is prompted for the text if interaction is possible; see
  727. X.BR \-I .
  728. X.PP
  729. XFor backward compatibility with older versions of \*r, a bare
  730. X.B \-t
  731. option is ignored.
  732. X.RE
  733. X.TP
  734. X.BI \-w "login"
  735. uses
  736. X.I login
  737. for the author field of the deposited revision.
  738. Useful for lying about the author, and for
  739. X.B \-k
  740. if no author is available.
  741. X.TP
  742. X.BI \-V n
  743. XEmulate \*r version
  744. X.IR n .
  745. See
  746. X.BR co (1)
  747. for details.
  748. X.TP
  749. X.BI \-x "suffixes"
  750. specifies the suffixes for \*r files.
  751. A nonempty suffix matches any pathname ending in the suffix.
  752. An empty suffix matches any pathname of the form
  753. X.BI RCS/ file
  754. or
  755. X.IB path /RCS/ file.
  756. The
  757. X.B \-x
  758. option can specify a list of suffixes
  759. separated by
  760. X.BR / .
  761. XFor example,
  762. X.B \-x,v/
  763. specifies two suffixes:
  764. X.B ,v
  765. and the empty suffix.
  766. If two or more suffixes are specified,
  767. they are tried in order when looking for an \*r file;
  768. the first one that works is used for that file.
  769. If no \*r file is found but an \*r file can be created,
  770. the suffixes are tried in order
  771. to determine the new \*r file's name.
  772. The default for
  773. X.IR suffixes
  774. is installation-dependent; normally it is
  775. X.B ,v/
  776. for hosts like Unix that permit commas in file names,
  777. and is empty (i.e. just the empty suffix) for other hosts.
  778. X.SH "FILE NAMING"
  779. Pairs of \*r files and working files may be specified in three ways
  780. X(see also the
  781. example section).
  782. X.PP
  783. X1) Both the \*r file and the working file are given.  The \*r pathname is of
  784. the form
  785. X.IB path1 / workfileX
  786. and the working pathname is of the form
  787. X.IB path2 / workfile
  788. where
  789. X.IB path1 /
  790. and
  791. X.IB path2 /
  792. are (possibly different or empty) paths,
  793. X.I workfile
  794. is a filename, and
  795. X.I X
  796. is an \*r suffix.
  797. If
  798. X.I X
  799. is empty,
  800. X.IB path1 /
  801. must be
  802. X.B RCS/
  803. or must end in
  804. X.BR /RCS/ .
  805. X.PP
  806. X2) Only the \*r file is given.  Then the working file is created in the current
  807. directory and its name is derived from the name of the \*r file
  808. by removing
  809. X.IB path1 /
  810. and the suffix
  811. X.IR X .
  812. X.PP
  813. X3) Only the working file is given.
  814. Then
  815. X.B ci
  816. considers each \*r suffix
  817. X.I X
  818. in turn, looking for an \*r file of the form
  819. X.IB path2 /RCS/ workfileX
  820. or (if the former is not found and
  821. X.I X
  822. is nonempty)
  823. X.IB path2 / workfileX.
  824. X.PP
  825. If the \*r file is specified without a path in 1) and 2),
  826. X.B ci
  827. looks for the \*r file first in the directory
  828. X.B ./RCS
  829. and then in the current
  830. directory.
  831. X.PP
  832. X.B ci
  833. reports an error if an attempt to open an \*r file fails for an unusual reason,
  834. even if the \*r file's pathname is just one of several possibilities.
  835. XFor example, to suppress use of \*r commands in a directory
  836. X.IR d ,
  837. create a regular file named
  838. X.IB d /RCS
  839. so that casual attempts to use \*r commands in
  840. X.I d
  841. fail because
  842. X.IB d /RCS
  843. is not a directory.
  844. X.SH EXAMPLES
  845. Suppose
  846. X.B ,v
  847. is an \*r suffix and the current directory contains a subdirectory
  848. X.B RCS
  849. with an \*r file
  850. X.BR io.c,v .
  851. Then each of the following commands check in a copy of
  852. X.B io.c
  853. into
  854. X.B RCS/io.c,v
  855. as the latest revision, removing
  856. X.BR io.c .
  857. X.LP
  858. X.RS
  859. X.nf
  860. X.ft 3
  861. ci  io.c;    ci  RCS/io.c,v;   ci  io.c,v;
  862. ci  io.c  RCS/io.c,v;    ci  io.c  io.c,v;
  863. ci  RCS/io.c,v  io.c;    ci  io.c,v  io.c;
  864. X.ft
  865. X.fi
  866. X.RE
  867. X.PP
  868. Suppose instead that the empty suffix
  869. is an \*r suffix and the current directory contains a subdirectory
  870. X.B RCS
  871. with an \*r file
  872. X.BR io.c .
  873. The each of the following commands checks in a new revision.
  874. X.LP
  875. X.RS
  876. X.nf
  877. X.ft 3
  878. ci  io.c;    ci  RCS/io.c;
  879. ci  io.c  RCS/io.c;
  880. ci  RCS/io.c  io.c;
  881. X.ft
  882. X.fi
  883. X.RE
  884. X.SH "FILE MODES"
  885. An \*r file created by
  886. X.B ci
  887. inherits the read and execute permissions
  888. from the working file.  If the \*r file exists already,
  889. X.B ci
  890. preserves its read and execute permissions.
  891. X.B ci
  892. always turns off all write permissions of \*r files.
  893. X.SH FILES
  894. Several temporary files may be created in the directory containing
  895. the working file, and also in the temporary directory (see
  896. X.B \s-1TMPDIR\s0
  897. under
  898. X.BR \s-1ENVIRONMENT\s0 ).
  899. A semaphore file or files are created in the directory containing the \*r file.
  900. With a nonempty suffix, the semaphore names begin with
  901. the first character of the suffix; therefore, do not specify an suffix
  902. whose first character could be that of a working filename.
  903. With an empty suffix, the semaphore names end with
  904. X.B _
  905. so working filenames should not end in
  906. X.BR _ .
  907. X.PP
  908. X.B ci
  909. never changes an \*r or working file.
  910. Normally,
  911. X.B ci
  912. unlinks the file and creates a new one;
  913. but instead of breaking a chain of one or more symbolic links to an \*r file,
  914. it unlinks the destination file instead.
  915. Therefore,
  916. X.B ci
  917. breaks any hard or symbolic links to any working file it changes;
  918. and hard links to \*r files are ineffective,
  919. but symbolic links to \*r files are preserved.
  920. X.PP
  921. The effective user must be able to
  922. search and write the directory containing the \*r file.
  923. Normally, the real user must be able to
  924. read the \*r and working files
  925. and to search and write the directory containing the working file;
  926. however, some older hosts
  927. cannot easily switch between real and effective users,
  928. so on these hosts the effective user is used for all accesses.
  929. The effective user is the same as the real user
  930. unless your copies of
  931. X.B ci
  932. and
  933. X.B co
  934. have setuid privileges.
  935. As described in the next section,
  936. these privileges yield extra security if
  937. the effective user owns all \*r files and directories,
  938. and if only the effective user can write \*r directories.
  939. X.PP
  940. Users can control access to \*r files by setting the permissions
  941. of the directory containing the files; only users with write access
  942. to the directory can use \*r commands to change its \*r files.
  943. XFor example, in hosts that allow a user to belong to several groups,
  944. one can make a group's \*r directories writable to that group only.
  945. This approach suffices for informal projects,
  946. but it means that any group member can arbitrarily change the group's \*r files,
  947. and can even remove them entirely.
  948. Hence more formal projects sometimes distinguish between an \*r administrator,
  949. who can change the \*r files at will, and other project members,
  950. who can check in new revisions but cannot otherwise change the \*r files.
  951. X.SH "SETUID USE"
  952. To prevent anybody but their \*r administrator from deleting revisions,
  953. a set of users can employ setuid privileges as follows.
  954. X.nr n \w'\(bu '+1n-1/1n
  955. X.IP \(bu \nn
  956. Check that the host supports \*r setuid use.
  957. Consult a trustworthy expert if there are any doubts.
  958. It is best if the
  959. X.B seteuid()
  960. system call works as described in Posix 1003.1a Draft 5,
  961. because \*r can switch back and forth easily
  962. between real and effective users, even if the real user is
  963. X.BR root .
  964. If not, the second best is if the
  965. X.B setuid()
  966. system call supports saved setuid
  967. X(the {\s-1_POSIX_SAVED_IDS\s0} behavior of Posix 1003.1-1990);
  968. this fails only if the real user is
  969. X.BR root .
  970. If \*r detects any failure in setuid, it quits immediately.
  971. X.IP \(bu \nn
  972. Choose a user
  973. X.I A
  974. to serve as \*r administrator for the set of users.
  975. Only
  976. X.I A
  977. will be able to invoke the
  978. X.B rcs
  979. command on the users' \*r files.
  980. X.I A
  981. should not be
  982. X.B root
  983. or any other user with special powers.
  984. Mutually suspicious sets of users should use different administrators.
  985. X.IP \(bu \nn
  986. Choose a path name
  987. X.I B
  988. that will be a directory of files to be executed by the users.
  989. X.IP \(bu \nn
  990. Have
  991. X.I A
  992. set up
  993. X.I B
  994. to contain copies of
  995. X.B ci
  996. and
  997. X.B co
  998. that are setuid to
  999. X.I A
  1000. by copying the commands from their standard installation directory
  1001. X.I D
  1002. as follows:
  1003. X.LP
  1004. X.RS
  1005. X.nf
  1006. X.ne 3
  1007. X\f3mkdir\fP  \f2B\fP
  1008. X\f3cp\fP  \f2D\fP\^\f3/c[io]\fP  \f2B\fP
  1009. X\f3chmod  go\-w,u+s\fP  \f2B\fP\f3/c[io]\fP
  1010. X.fi
  1011. X.RE
  1012. X.IP \(bu \nn
  1013. Have each user prepend
  1014. X.I B
  1015. to their path as follows:
  1016. X.LP
  1017. X.RS
  1018. X.nf
  1019. X.ne 2
  1020. X\f3PATH=\fP\f2B\fP\f3:$PATH;  export  PATH\fP  # ordinary shell
  1021. X\f3set  path=(\fP\f2B\fP  \f3$path)\fP  # C shell
  1022. X.fi
  1023. X.RE
  1024. X.IP \(bu \nn
  1025. Have
  1026. X.I A
  1027. create each \*r directory
  1028. X.I R
  1029. with write access only to
  1030. X.I A
  1031. as follows:
  1032. X.LP
  1033. X.RS
  1034. X.nf
  1035. X.ne 2
  1036. X\f3mkdir\fP  \f2R\fP
  1037. X\f3chmod  go\-w\fP  \f2R\fP
  1038. X.fi
  1039. X.RE
  1040. X.IP \(bu \nn
  1041. If you want to let only certain users read the \*r files,
  1042. put the users into a group
  1043. X.IR G ,
  1044. and have
  1045. X.I A
  1046. further protect the \*r directory as follows:
  1047. X.LP
  1048. X.RS
  1049. X.nf
  1050. X.ne 2
  1051. X\f3chgrp\fP  \f2G  R\fP
  1052. X\f3chmod  g\-w,o\-rwx\fP  \f2R\fP
  1053. X.fi
  1054. X.RE
  1055. X.IP \(bu \nn
  1056. Have
  1057. X.I A
  1058. copy old \*r files (if any) into
  1059. X.IR R ,
  1060. to ensure that
  1061. X.I A
  1062. owns them.
  1063. X.IP \(bu \nn
  1064. An \*r file's access list limits who can check in and lock revisions.
  1065. The default access list is empty,
  1066. which grants checkin access to anyone who can read the \*r file.
  1067. If you want limit checkin access,
  1068. have
  1069. X.I A
  1070. invoke
  1071. X.B "rcs\ \-a"
  1072. on the file; see
  1073. X.BR rcs (1).
  1074. In particular,
  1075. X.BI "rcs\ \-e\ \-a" A
  1076. limits access to just
  1077. X.IR A .
  1078. X.IP \(bu \nn
  1079. Have
  1080. X.I A
  1081. initialize any new \*r files with
  1082. X.B "rcs\ \-i"
  1083. before initial checkin, adding the
  1084. X.B \-a
  1085. option if you want to limit checkin access.
  1086. X.IP \(bu \nn
  1087. Give setuid privileges only to
  1088. X.BR ci ,
  1089. X.BR co ,
  1090. and
  1091. X.BR rcsclean ;
  1092. do not give them to
  1093. X.B rcs
  1094. or to any other command.
  1095. X.IP \(bu \nn
  1096. Do not use other setuid commands to invoke \*r commands;
  1097. setuid is trickier than you think!
  1098. X.SH ENVIRONMENT
  1099. X.TP
  1100. X.B \s-1RCSINIT\s0
  1101. options prepended to the argument list, separated by spaces.
  1102. A backslash escapes spaces within an option.
  1103. The
  1104. X.B \s-1RCSINIT\s0
  1105. options are prepended to the argument lists of most \*r commands.
  1106. Useful
  1107. X.B \s-1RCSINIT\s0
  1108. options include
  1109. X.BR \-q ,
  1110. X.BR \-V ,
  1111. and
  1112. X.BR \-x .
  1113. X.TP
  1114. X.B \s-1TMPDIR\s0
  1115. Name of the temporary directory.
  1116. If not set, the environment variables
  1117. X.B \s-1TMP\s0
  1118. and
  1119. X.B \s-1TEMP\s0
  1120. are inspected instead and the first value found is taken;
  1121. if none of them are set,
  1122. a host-dependent default is used, typically
  1123. X.BR /tmp .
  1124. X.SH DIAGNOSTICS
  1125. XFor each revision,
  1126. X.B ci
  1127. prints the \*r file, the working file, and the number
  1128. of both the deposited and the preceding revision.
  1129. The exit status is zero if and only if all operations were successful.
  1130. X.SH IDENTIFICATION
  1131. Author: Walter F. Tichy.
  1132. X.br
  1133. Revision Number: \*(Rv; Release Date: \*(Dt.
  1134. X.br
  1135. Copyright \(co 1982, 1988, 1989 by Walter F. Tichy.
  1136. X.br
  1137. Copyright \(co 1990, 1991 by Paul Eggert.
  1138. X.SH "SEE ALSO"
  1139. co(1), ident(1), make(1), rcs(1), rcsclean(1), rcsdiff(1),
  1140. rcsintro(1), rcsmerge(1), rlog(1), rcsfile(5)
  1141. X.br
  1142. Walter F. Tichy,
  1143. X\*r\*-A System for Version Control,
  1144. X.I "Software\*-Practice & Experience"
  1145. X.BR 15 ,
  1146. X7 (July 1985), 637-654.
  1147. X.br
  1148. END_OF_FILE
  1149. if test 17938 -ne `wc -c <'man/ci.1'`; then
  1150.     echo shar: \"'man/ci.1'\" unpacked with wrong size!
  1151. fi
  1152. # end of 'man/ci.1'
  1153. fi
  1154. if test -f 'man/co.1' -a "${1}" != "-c" ; then 
  1155.   echo shar: Will not clobber existing file \"'man/co.1'\"
  1156. else
  1157. echo shar: Extracting \"'man/co.1'\" \(13648 characters\)
  1158. sed "s/^X//" >'man/co.1' <<'END_OF_FILE'
  1159. X.de Id
  1160. X.ds Rv \\$3
  1161. X.ds Dt \\$4
  1162. X..
  1163. X.Id $Id: co.1,v 5.7 1991/08/19 03:13:55 eggert Exp $
  1164. X.ds g \&\s-1UTC\s0
  1165. X.ds r \&\s-1RCS\s0
  1166. X.if n .ds - \%--
  1167. X.if t .ds - \(em
  1168. X.TH CO 1 \*(Dt GNU
  1169. X.SH NAME
  1170. co \- check out RCS revisions
  1171. X.SH SYNOPSIS
  1172. X.B co
  1173. X.RI [ options ] " file " .\|.\|.
  1174. X.SH DESCRIPTION
  1175. X.B co
  1176. retrieves a revision from each \*r file and stores it into
  1177. the corresponding working file.
  1178. X.PP
  1179. Pathnames matching an \*r suffix denote \*r files;
  1180. all others denote working files.
  1181. Names are paired as explained in
  1182. X.BR ci (1).
  1183. X.PP
  1184. Revisions of an \*r file may be checked out locked or unlocked.  Locking a
  1185. revision prevents overlapping updates.  A revision checked out for reading or
  1186. processing (e.g., compiling) need not be locked.  A revision checked out
  1187. for editing and later checkin must normally be locked.  Checkout with locking
  1188. fails if the revision to be checked out is currently locked by another user.
  1189. X(A lock may be broken with
  1190. X.BR rcs "(1).)\ \&"
  1191. Checkout with locking also requires the caller to be on the access list of
  1192. the \*r file, unless he is the owner of the
  1193. file or the superuser, or the access list is empty.
  1194. Checkout without locking is not subject to accesslist restrictions, and is
  1195. not affected by the presence of locks.
  1196. X.PP
  1197. A revision is selected by options for revision or branch number,
  1198. checkin date/time, author, or state.
  1199. When the selection options
  1200. are applied in combination,
  1201. X.B co
  1202. retrieves the latest revision
  1203. that satisfies all of them.
  1204. If none of the selection options
  1205. is specified,
  1206. X.B co
  1207. retrieves the latest revision
  1208. on the default branch (normally the trunk, see the
  1209. X.B \-b
  1210. option of
  1211. X.BR rcs (1)).
  1212. A revision or branch number may be attached
  1213. to any of the options
  1214. X.BR \-f ,
  1215. X.BR \-I ,
  1216. X.BR \-l ,
  1217. X.BR \-M ,
  1218. X.BR \-p ,
  1219. X.BR \-q ,
  1220. X.BR \-r ,
  1221. or
  1222. X.BR \-u .
  1223. The options
  1224. X.B \-d
  1225. X(date),
  1226. X.B \-s
  1227. X(state), and
  1228. X.B \-w
  1229. X(author)
  1230. retrieve from a single branch, the
  1231. X.I selected
  1232. branch,
  1233. which is either specified by one of
  1234. X.BR \-f,
  1235. X\&.\|.\|.,
  1236. X.BR \-u ,
  1237. or the default branch.
  1238. X.PP
  1239. A
  1240. X.B co
  1241. command applied to an \*r
  1242. file with no revisions creates a zero-length working file.
  1243. X.B co
  1244. always performs keyword substitution (see below).
  1245. X.SH OPTIONS
  1246. X.TP
  1247. X.BR \-r [\f2rev\fP]
  1248. retrieves the latest revision whose number is less than or equal to
  1249. X.I rev.
  1250. If
  1251. X.I rev
  1252. indicates a branch rather than a revision,
  1253. the latest revision on that branch is retrieved.
  1254. If
  1255. X.I rev
  1256. is omitted, the latest revision on the default branch
  1257. X(see the
  1258. X.B \-b
  1259. option of
  1260. X.BR rcs (1))
  1261. is retrieved.
  1262. If
  1263. X.I rev
  1264. is
  1265. X.BR $ ,
  1266. X.B co
  1267. determines the revision number from keyword values in the working file.
  1268. Otherwise, a revision is composed of one or more numeric or symbolic fields
  1269. separated by periods.  The numeric equivalent of a symbolic field
  1270. is specified with the
  1271. X.B \-n
  1272. option of the commands
  1273. X.BR ci (1)
  1274. and
  1275. X.BR rcs (1).
  1276. X.TP
  1277. X.BR \-l [\f2rev\fP]
  1278. same as
  1279. X.BR \-r ,
  1280. except that it also locks the retrieved revision for
  1281. the caller.
  1282. X.TP
  1283. X.BR \-u [\f2rev\fP]
  1284. same as
  1285. X.BR \-r ,
  1286. except that it unlocks the retrieved revision if it was
  1287. locked by the caller.  If
  1288. X.I rev
  1289. is omitted,
  1290. X.B \-u
  1291. retrieves the revision locked by the caller, if there is one; otherwise,
  1292. it retrieves the latest revision on the default branch.
  1293. X.TP
  1294. X.BR \-f [\f2rev\fP]
  1295. forces the overwriting of the working file;
  1296. useful in connection with
  1297. X.BR \-q .
  1298. See also
  1299. X.SM "FILE MODES"
  1300. below.
  1301. X.TP
  1302. X.B \-kkv
  1303. Generate keyword strings using the default form, e.g.\&
  1304. X.B "$\&Revision: \*(Rv $"
  1305. for the
  1306. X.B Revision
  1307. keyword.
  1308. A locker's name is inserted in the value of the
  1309. X.BR Header ,
  1310. X.BR Id ,
  1311. and
  1312. X.B Locker
  1313. keyword strings
  1314. only as a file is being locked,
  1315. i.e. by
  1316. X.B "ci\ \-l"
  1317. and
  1318. X.BR "co\ \-l".
  1319. This is the default.
  1320. X.TP
  1321. X.B \-kkvl
  1322. Like
  1323. X.BR \-kkv ,
  1324. except that a locker's name is always inserted
  1325. if the given revision is currently locked.
  1326. X.TP
  1327. X.BR \-kk
  1328. Generate only keyword names in keyword strings; omit their values.
  1329. See
  1330. X.SM "KEYWORD SUBSTITUTION"
  1331. below.
  1332. XFor example, for the
  1333. X.B Revision
  1334. keyword, generate the string
  1335. X.B $\&Revision$
  1336. instead of
  1337. X.BR "$\&Revision: \*(Rv $".
  1338. This option is useful to ignore differences due to keyword substitution
  1339. when comparing different revisions of a file.
  1340. X.TP
  1341. X.BR \-ko
  1342. Generate the old keyword string,
  1343. present in the working file just before it was checked in.
  1344. XFor example, for the
  1345. X.B Revision
  1346. keyword, generate the string
  1347. X.B "$\&Revision: 1.1 $"
  1348. instead of
  1349. X.B "$\&Revision: \*(Rv $"
  1350. if that is how the string appeared when the file was checked in.
  1351. This can be useful for binary file formats
  1352. that cannot tolerate any changes to substrings
  1353. that happen to take the form of keyword strings.
  1354. X.TP
  1355. X.BR \-kv
  1356. Generate only keyword values for keyword strings.
  1357. XFor example, for the
  1358. X.B Revision
  1359. keyword, generate the string
  1360. X.B \*(Rv
  1361. instead of
  1362. X.BR "$\&Revision: \*(Rv $".
  1363. This can help generate files in programming languages where it is hard to
  1364. strip keyword delimiters like
  1365. X.B "$\&Revision:\ $"
  1366. from a string.
  1367. However, further keyword substitution cannot be performed once the
  1368. keyword names are removed, so this option should be used with care.
  1369. Because of this danger of losing keywords,
  1370. this option cannot be combined with
  1371. X.BR \-l ,
  1372. and the owner write permission of the working file is turned off;
  1373. to edit the file later, check it out again without
  1374. X.BR \-kv .
  1375. X.TP
  1376. X.BR \-p [\f2rev\fP]
  1377. prints the retrieved revision on the standard output rather than storing it
  1378. in the working file.
  1379. This option is useful when
  1380. X.B co
  1381. is part of a pipe.
  1382. X.TP
  1383. X.BR \-q [\f2rev\fP]
  1384. quiet mode; diagnostics are not printed.
  1385. X.TP
  1386. X.BR \-I [\f2rev\fP]
  1387. interactive mode;
  1388. the user is prompted and questioned
  1389. even if the standard input is not a terminal.
  1390. X.TP
  1391. X.BI \-d date
  1392. retrieves the latest revision on the selected branch whose checkin date/time is
  1393. less than or equal to
  1394. X.I date.
  1395. The date and time may be given in free format.
  1396. The time zone
  1397. X.B LT
  1398. stands for local time;
  1399. other common time zone names are understood.
  1400. XFor example, the following
  1401. X.IR date s
  1402. are equivalent
  1403. if local time is January 11, 1990, 8pm Pacific Standard Time,
  1404. eight hours west of Coordinated Universal Time (\*g):
  1405. X.RS
  1406. X.LP
  1407. X.RS
  1408. X.nf
  1409. X.ta \w'\f3Thu, 11 Jan 1990 20:00:00 \-0800\fP  'u
  1410. X.ne 9
  1411. X\f38:00 pm lt\fP
  1412. X\f34:00 AM, Jan. 12, 1990\fP    note: default is \*g
  1413. X\f31990/01/12 04:00:00\fP    \*r date format
  1414. X\f3Thu Jan 11 20:00:00 1990 LT\fP    output of \f3ctime\fP(3) + \f3LT\fP
  1415. X\f3Thu Jan 11 20:00:00 PST 1990\fP    output of \f3date\fP(1)
  1416. X\f3Fri Jan 12 04:00:00 GMT 1990\fP
  1417. X\f3Thu, 11 Jan 1990 20:00:00 \-0800\fP
  1418. X\f3Fri-JST, 1990, 1pm Jan 12\fP
  1419. X\f312-January-1990, 04:00-WET\fP
  1420. X.ta 4n +4n +4n +4n
  1421. X.fi
  1422. X.RE
  1423. X.LP
  1424. Most fields in the date and time may be defaulted.
  1425. The default time zone is \*g.
  1426. The other defaults are determined in the order year, month, day,
  1427. hour, minute, and second (most to least significant).  At least one of these
  1428. fields must be provided.  For omitted fields that are of higher significance
  1429. than the highest provided field, the time zone's current values are assumed.
  1430. XFor all other omitted fields,
  1431. the lowest possible values are assumed.
  1432. XFor example, the date
  1433. X.B "20, 10:30"
  1434. defaults to
  1435. X10:30:00 \*g of the 20th of the \*g time zone's current month and year.
  1436. The date/time must be quoted if it contains spaces.
  1437. X.RE
  1438. X.TP
  1439. X.BR \-M [\f2rev\fP]
  1440. Set the modification time on the new working file
  1441. to be the date of the retrieved revision.
  1442. Use this option with care; it can confuse
  1443. X.BR make (1).
  1444. X.TP
  1445. X.BI \-s state
  1446. retrieves the latest revision on the selected branch whose state is set to
  1447. X.I state.
  1448. X.TP
  1449. X.BR \-w [\f2login\fP]
  1450. retrieves the latest revision on the selected branch which was checked in
  1451. by the user with login name
  1452. X.I login.
  1453. If the argument
  1454. X.I login
  1455. is
  1456. omitted, the caller's login is assumed.
  1457. X.TP
  1458. X.BI \-j joinlist
  1459. generates a new revision which is the join of the revisions on
  1460. X.I joinlist.
  1461. This option is largely obsoleted by
  1462. X.BR rcsmerge (1)
  1463. but is retained for backwards compatibility.
  1464. X.RS
  1465. X.PP
  1466. The
  1467. X.I joinlist
  1468. is a comma-separated list of pairs of the form
  1469. X.IB rev2 : rev3,
  1470. where
  1471. X.I rev2
  1472. and
  1473. X.I rev3
  1474. are (symbolic or numeric)
  1475. revision numbers.
  1476. XFor the initial such pair,
  1477. X.I rev1
  1478. denotes the revision selected
  1479. by the above options
  1480. X.BR \-f,
  1481. X\&.\|.\|.,
  1482. X.BR \-w .
  1483. XFor all other pairs,
  1484. X.I rev1
  1485. denotes the revision generated by the previous pair.
  1486. X(Thus, the output
  1487. of one join becomes the input to the next.)
  1488. X.PP
  1489. XFor each pair,
  1490. X.B co
  1491. joins revisions
  1492. X.I rev1
  1493. and
  1494. X.I rev3
  1495. with respect to
  1496. X.I rev2.
  1497. This means that all changes that transform
  1498. X.I rev2
  1499. into
  1500. X.I rev1
  1501. are applied to a copy of
  1502. X.I rev3.
  1503. This is particularly useful if
  1504. X.I rev1
  1505. and
  1506. X.I rev3
  1507. are the ends of two branches that have
  1508. X.I rev2
  1509. as a common ancestor.  If
  1510. X.IR rev1 < rev2 < rev3
  1511. on the same branch,
  1512. joining generates a new revision which is like
  1513. X.I rev3,
  1514. but with all changes that lead from
  1515. X.I rev1
  1516. to
  1517. X.I rev2
  1518. undone.
  1519. If changes from
  1520. X.I rev2
  1521. to
  1522. X.I rev1
  1523. overlap with changes from
  1524. X.I rev2
  1525. to
  1526. X.I rev3,
  1527. X.B co
  1528. reports overlaps as described in
  1529. X.BR merge (1).
  1530. X.PP
  1531. XFor the initial pair,
  1532. X.I rev2
  1533. may be omitted.  The default is the common
  1534. ancestor.
  1535. If any of the arguments indicate branches, the latest revisions
  1536. on those branches are assumed.
  1537. The options
  1538. X.B \-l
  1539. and
  1540. X.B \-u
  1541. lock or unlock
  1542. X.I rev1.
  1543. X.RE
  1544. X.TP
  1545. X.BI \-V n
  1546. XEmulate \*r version
  1547. X.I n,
  1548. where
  1549. X.I n
  1550. may be
  1551. X.BR 3 ,
  1552. X.BR 4 ,
  1553. or
  1554. X.BR 5 .
  1555. This may be useful when interchanging \*r files with others who are
  1556. running older versions of \*r.
  1557. To see which version of \*r your correspondents are running, have them invoke
  1558. X.B rlog
  1559. on an \*r file;
  1560. if none of the first few lines of output contain the string
  1561. X.B branch:
  1562. it is version 3;
  1563. if the dates' years have just two digits, it is version 4;
  1564. otherwise, it is version 5.
  1565. An \*r file generated while emulating version 3 will lose its default branch.
  1566. An \*r revision generated while emulating version 4 or earlier will have
  1567. a timestamp that is off by up to 13 hours.
  1568. A revision extracted while emulating version 4 or earlier will contain
  1569. dates of the form
  1570. X.IB yy / mm / dd
  1571. instead of
  1572. X.IB yyyy / mm / dd
  1573. and may also contain different white space in the substitution for
  1574. X.BR $\&Log$ .
  1575. X.TP
  1576. X.BI \-x "suffixes"
  1577. Use
  1578. X.I suffixes
  1579. to characterize \*r files.
  1580. See
  1581. X.BR ci (1)
  1582. for details.
  1583. X.SH "KEYWORD SUBSTITUTION"
  1584. Strings of the form
  1585. X.BI $ keyword $
  1586. and
  1587. X.BI $ keyword : .\|.\|. $
  1588. embedded in
  1589. the text are replaced
  1590. with strings of the form
  1591. X.BI $ keyword : value $
  1592. where
  1593. X.I keyword
  1594. and
  1595. X.I value
  1596. are pairs listed below.
  1597. Keywords may be embedded in literal strings
  1598. or comments to identify a revision.
  1599. X.PP
  1600. Initially, the user enters strings of the form
  1601. X.BI $ keyword $ .
  1602. On checkout,
  1603. X.B co
  1604. replaces these strings with strings of the form
  1605. X.BI $ keyword : value $ .
  1606. If a revision containing strings of the latter form
  1607. is checked back in, the value fields will be replaced during the next
  1608. checkout.
  1609. Thus, the keyword values are automatically updated on checkout.
  1610. This automatic substitution can be modified by the
  1611. X.B \-k
  1612. options.
  1613. X.PP
  1614. Keywords and their corresponding values:
  1615. X.TP
  1616. X.B $\&Author$
  1617. The login name of the user who checked in the revision.
  1618. X.TP
  1619. X.B $\&Date$
  1620. The date and time (\*g) the revision was checked in.
  1621. X.TP
  1622. X.B $\&Header$
  1623. A standard header containing the full pathname of the \*r file, the
  1624. revision number, the date (\*g), the author, the state,
  1625. and the locker (if locked).
  1626. X.TP
  1627. X.B $\&Id$
  1628. Same as
  1629. X.BR $\&Header$ ,
  1630. except that the \*r filename is without a path.
  1631. X.TP
  1632. X.B $\&Locker$
  1633. The login name of the user who locked the revision (empty if not locked).
  1634. X.TP
  1635. X.B $\&Log$
  1636. The log message supplied during checkin, preceded by a header
  1637. containing the \*r filename, the revision number, the author, and the date
  1638. X(\*g).
  1639. XExisting log messages are
  1640. X.I not
  1641. replaced.
  1642. Instead, the new log message is inserted after
  1643. X.BR $\&Log: .\|.\|. $ .
  1644. This is useful for
  1645. accumulating a complete change log in a source file.
  1646. X.TP
  1647. X.B $\&RCSfile$
  1648. The name of the \*r file without a path.
  1649. X.TP
  1650. X.B $\&Revision$
  1651. The revision number assigned to the revision.
  1652. X.TP
  1653. X.B $\&Source$
  1654. The full pathname of the \*r file.
  1655. X.TP
  1656. X.B $\&State$
  1657. The state assigned to the revision with the
  1658. X.B \-s
  1659. option of
  1660. X.BR rcs (1)
  1661. or
  1662. X.BR ci (1).
  1663. X.SH "FILE MODES"
  1664. The working file inherits the read and execute permissions from the \*r
  1665. file.  In addition, the owner write permission is turned on, unless
  1666. X.B \-kv
  1667. is set or the file
  1668. is checked out unlocked and locking is set to strict (see
  1669. X.BR rcs (1)).
  1670. X.PP
  1671. If a file with the name of the working file exists already and has write
  1672. permission,
  1673. X.B co
  1674. aborts the checkout,
  1675. asking beforehand if possible.
  1676. If the existing working file is
  1677. not writable or
  1678. X.B \-f
  1679. is given, the working file is deleted without asking.
  1680. X.SH FILES
  1681. X.B co
  1682. accesses files much as
  1683. X.BR ci (1)
  1684. does, except that it does not need to read the working file.
  1685. X.SH ENVIRONMENT
  1686. X.TP
  1687. X.B \s-1RCSINIT\s0
  1688. options prepended to the argument list, separated by spaces.
  1689. See
  1690. X.BR ci (1)
  1691. for details.
  1692. X.SH DIAGNOSTICS
  1693. The \*r pathname, the working pathname,
  1694. and the revision number retrieved are
  1695. written to the diagnostic output.
  1696. The exit status is zero if and only if all operations were successful.
  1697. X.SH IDENTIFICATION
  1698. Author: Walter F. Tichy.
  1699. X.br
  1700. Revision Number: \*(Rv; Release Date: \*(Dt.
  1701. X.br
  1702. Copyright \(co 1982, 1988, 1989 by Walter F. Tichy.
  1703. X.br
  1704. Copyright \(co 1990, 1991 by Paul Eggert.
  1705. X.SH "SEE ALSO"
  1706. ci(1), ctime(3), date(1), ident(1), make(1),
  1707. rcs(1), rcsdiff(1), rcsintro(1), rcsmerge(1), rlog(1),
  1708. rcsfile(5)
  1709. X.br
  1710. Walter F. Tichy,
  1711. X\*r\*-A System for Version Control,
  1712. X.I "Software\*-Practice & Experience"
  1713. X.BR 15 ,
  1714. X7 (July 1985), 637-654.
  1715. X.SH LIMITS
  1716. Links to the \*r and working files are not preserved.
  1717. X.PP
  1718. There is no way to selectively suppress the expansion of keywords, except
  1719. by writing them differently.  In nroff and troff, this is done by embedding the
  1720. null-character
  1721. X.B \e&
  1722. into the keyword.
  1723. X.SH BUGS
  1724. The
  1725. X.B \-d
  1726. option sometimes gets confused, and accepts no date before 1970.
  1727. X.br
  1728. END_OF_FILE
  1729. if test 13648 -ne `wc -c <'man/co.1'`; then
  1730.     echo shar: \"'man/co.1'\" unpacked with wrong size!
  1731. fi
  1732. # end of 'man/co.1'
  1733. fi
  1734. if test -f 'src/conf.heg' -a "${1}" != "-c" ; then 
  1735.   echo shar: Will not clobber existing file \"'src/conf.heg'\"
  1736. else
  1737. echo shar: Extracting \"'src/conf.heg'\" \(14899 characters\)
  1738. sed "s/^X//" >'src/conf.heg' <<'END_OF_FILE'
  1739. X/* example RCS compile-time configuration */
  1740. X
  1741. X    /* $Id: conf.heg,v 1.8 1991/11/20 18:21:09 eggert Exp $ */
  1742. X
  1743. X/*
  1744. X * This example RCS compile-time configuration describes a host that conforms
  1745. X * to Standard C (1990) and Posix 1003.1-1990 and has GNU diff.
  1746. X * If you can't get conf.sh to work as described in the Makefile,
  1747. X * copy this file to conf.h and edit conf.h by hand; see README.
  1748. X */
  1749. X
  1750. X#define exitmain(n) return n /* how to exit from main() */
  1751. X/* #define _POSIX_SOURCE */ /* Define this if Posix + strict Standard C.  */
  1752. X
  1753. X#include <errno.h>
  1754. X#include <stdio.h>
  1755. X#include <time.h>
  1756. X
  1757. X/* Comment out #include lines below that do not work.  */
  1758. X#include <sys/types.h>
  1759. X#include <sys/stat.h>
  1760. X#include <dirent.h>
  1761. X#include <fcntl.h>
  1762. X#include <limits.h>
  1763. X#include <pwd.h>
  1764. X#include <signal.h>
  1765. X#include <stdlib.h>
  1766. X#include <string.h>
  1767. X/* #include <sys/mman.h> */
  1768. X#include <sys/wait.h>
  1769. X#include <unistd.h>
  1770. X#include <utime.h>
  1771. X/* #include <vfork.h> */
  1772. X
  1773. X/* Define the following symbols to be 1 or 0.  */
  1774. X#define has_sys_dir_h 0 /* Does #include <sys/dir.h> work?  */
  1775. X#define has_sys_param_h 0 /* Does #include <sys/param.h> work?  */
  1776. X#define has_readlink 0 /* Does readlink() work?  */
  1777. X
  1778. X/* #undef NAME_MAX */ /* Uncomment this if NAME_MAX is broken.  */
  1779. X
  1780. X#if !defined(NAME_MAX) && !defined(_POSIX_NAME_MAX)
  1781. X#    if has_sys_dir_h
  1782. X#        include <sys/dir.h>
  1783. X#    endif
  1784. X#    ifndef NAME_MAX
  1785. X#        ifndef MAXNAMLEN
  1786. X#            define MAXNAMLEN 14
  1787. X#        endif
  1788. X#        define NAME_MAX MAXNAMLEN
  1789. X#    endif
  1790. X#endif
  1791. X#if !defined(PATH_MAX) && !defined(_POSIX_PATH_MAX)
  1792. X#    if has_sys_param_h
  1793. X#        include <sys/param.h>
  1794. X#        define included_sys_param_h 1
  1795. X#    endif
  1796. X#    ifndef PATH_MAX
  1797. X#        ifndef MAXPATHLEN
  1798. X#            define MAXPATHLEN 1024
  1799. X#        endif
  1800. X#        define PATH_MAX (MAXPATHLEN-1)
  1801. X#    endif
  1802. X#endif
  1803. X#if has_readlink && !defined(MAXSYMLINKS)
  1804. X#    if has_sys_param_h && !included_sys_param_h
  1805. X#        include <sys/param.h>
  1806. X#    endif
  1807. X#    ifndef MAXSYMLINKS
  1808. X#        define MAXSYMLINKS 20 /* BSD; not standard yet */
  1809. X#    endif
  1810. X#endif
  1811. X
  1812. X/* Comment out the keyword definitions below if the keywords work.  */
  1813. X/* #define const */
  1814. X/* #define volatile */
  1815. X
  1816. X/* Comment out the typedefs below if the types are already declared.  */
  1817. X/* Fix any uncommented typedefs that are wrong.  */
  1818. X/* typedef int mode_t; */
  1819. X/* typedef int pid_t; */
  1820. X/* typedef int sig_atomic_t; */
  1821. X/* typedef unsigned size_t; */
  1822. X/* typedef int ssize_t; */
  1823. X/* typedef long time_t; */
  1824. X/* typedef int uid_t; */
  1825. X
  1826. X/* Define the following symbols to be 1 or 0.  */
  1827. X#define has_prototypes 1 /* Do function prototypes work?  */
  1828. X#define has_stdarg 1 /* Does <stdarg.h> work?  */
  1829. X#define has_varargs 0 /* Does <varargs.h> work?  */
  1830. X#define va_start_args 2 /* How many args does va_start() take?  */
  1831. X#if has_prototypes
  1832. X#    define P(params) params
  1833. X#else
  1834. X#    define P(params) ()
  1835. X#endif
  1836. X#if has_stdarg
  1837. X#    include <stdarg.h>
  1838. X#else
  1839. X#    if has_varargs
  1840. X#        include <varargs.h>
  1841. X#    else
  1842. X        typedef char *va_list;
  1843. X#        define va_dcl int va_alist;
  1844. X#        define va_start(ap) ((ap) = (va_list)&va_alist)
  1845. X#        define va_arg(ap,t) (((t*) ((ap)+=sizeof(t)))  [-1])
  1846. X#        define va_end(ap)
  1847. X#    endif
  1848. X#endif
  1849. X#if va_start_args == 2
  1850. X#    define vararg_start va_start
  1851. X#else
  1852. X#    define vararg_start(ap,p) va_start(ap)
  1853. X#endif
  1854. X
  1855. X#define text_equals_binary_stdio 1 /* Does stdio treat text like binary?  */
  1856. X#define text_work_stdio 0 /* Text i/o for working file, binary for RCS file?  */
  1857. X#if text_equals_binary_stdio
  1858. X    /* Text and binary i/o behave the same, or binary i/o does not work.  */
  1859. X#    define FOPEN_R "r"
  1860. X#    define FOPEN_W "w"
  1861. X#    define FOPEN_WPLUS "w+"
  1862. X#else
  1863. X    /* Text and binary i/o behave differently.  */
  1864. X    /* This is incompatible with Posix and Unix.  */
  1865. X#    define FOPEN_R "rb"
  1866. X#    define FOPEN_W "wb"
  1867. X#    define FOPEN_WPLUS "w+b"
  1868. X#endif
  1869. X#if text_work_stdio
  1870. X#    define FOPEN_R_WORK "r"
  1871. X#    define FOPEN_W_WORK "w"
  1872. X#    define FOPEN_WPLUS_WORK "w+"
  1873. X#else
  1874. X#    define FOPEN_R_WORK FOPEN_R
  1875. X#    define FOPEN_W_WORK FOPEN_W
  1876. X#    define FOPEN_WPLUS_WORK FOPEN_WPLUS
  1877. X#endif
  1878. X
  1879. X/* Define or comment out the following symbols as needed.  */
  1880. X#define bad_fopen_wplus 0 /* Does fopen(f,FOPEN_WPLUS) fail to truncate f?  */
  1881. X#define getlogin_is_secure 0 /* Is getlogin() secure?  Usually it's not.  */
  1882. X#define has_dirent 1 /* Do opendir(), readdir(), closedir() work?  */
  1883. X#define has_fchmod 0 /* Does fchmod() work?  */
  1884. X#define has_fputs 1 /* Does fputs() work?  */
  1885. X#define has_ftruncate 0 /* Does ftruncate() work?  */
  1886. X#define has_getuid 1 /* Does getuid() work?  */
  1887. X#define has_getpwuid 1 /* Does getpwuid() work?  */
  1888. X#define has_link 1 /* Does link() work?  */
  1889. X#define has_memcmp 1 /* Does memcmp() work?  */
  1890. X#define has_memcpy 1 /* Does memcpy() work?  */
  1891. X#define has_memmove 1 /* Does memmove() work?  */
  1892. X#define has_madvise 0 /* Does madvise() work?  */
  1893. X#define has_mmap 0 /* Does mmap() work on regular files?  */
  1894. X#define has_rename 1 /* Does rename() work?  */
  1895. X#define bad_a_rename 0 /* Does rename(A,B) fail if A is unwritable?  */
  1896. X#define bad_b_rename 0 /* Does rename(A,B) fail if B is unwritable?  */
  1897. X#define VOID (void) /* 'VOID e;' discards the value of an expression 'e'.  */
  1898. X#define has_seteuid 0 /* Does seteuid() work?  See README.  */
  1899. X#define has_setuid 1 /* Does setuid() exist?  */
  1900. X#define has_signal 1 /* Does signal() work?  */
  1901. X#define signal_args P((int)) /* arguments of signal handlers */
  1902. X#define signal_type void /* type returned by signal handlers */
  1903. X#define sig_zaps_handler 0 /* Must a signal handler reinvoke signal()?  */
  1904. X#define has_sigaction 1 /* Does struct sigaction work?  */
  1905. X#define has_sigblock 0 /* Does sigblock() work?  */
  1906. X/* #define sigmask(s) (1 << ((s)-1)) */ /* Yield mask for signal number.  */
  1907. X#define has_sys_siglist 0 /* Does sys_siglist[] work?  */
  1908. typedef ssize_t fread_type; /* type returned by fread() and fwrite() */
  1909. typedef size_t freadarg_type; /* type of their size arguments */
  1910. typedef void *malloc_type; /* type returned by malloc() */
  1911. X#define has_getcwd 1 /* Does getcwd() work?  */
  1912. X#define has_getwd 0 /* Does getwd() work?  */
  1913. X#define has_mktemp 0 /* Does mktemp() work?  */
  1914. X#define has_NFS 0 /* Might NFS be used?  */
  1915. X/* #define strchr index */ /* Use old-fashioned name for strchr()?  */
  1916. X/* #define strrchr rindex */ /* Use old-fashioned name for strrchr()?  */
  1917. X#define bad_unlink 0 /* Does unlink() fail on unwritable files?  */
  1918. X#define has_vfork 0 /* Does vfork() work?  */
  1919. X#define has_fork 1 /* Does fork() work?  */
  1920. X#define has_spawn 0 /* Does spawn*() work?  */
  1921. X#define has_wait 1 /* Does wait() work?  */
  1922. X#define has_waitpid 1 /* Does waitpid() work?  */
  1923. X#define RCS_SHELL "/bin/sh" /* shell to run RCS subprograms */
  1924. X#define has_vfprintf 1 /* Does vfprintf() work?  */
  1925. X#define has__doprintf 0 /* Does _doprintf() work?  */
  1926. X#define has__doprnt 0 /* Does _doprnt() work?  */
  1927. X/* #undef EXIT_FAILURE */ /* Uncomment this if EXIT_FAILURE is broken.  */
  1928. X#define large_memory 0 /* Can main memory hold entire RCS files?  */
  1929. X/* #undef ULONG_MAX */ /* Uncomment this if ULONG_MAX is broken (e.g. < 0).  */
  1930. X/* struct utimbuf { time_t actime, modtime; }; */ /* Uncomment this if needed.  */
  1931. X#define CO "/usr/local/bin/co" /* name of 'co' program */
  1932. X#define COMPAT2 0 /* Are version 2 files supported?  */
  1933. X#define DATEFORM "%.2d.%.2d.%.2d.%.2d.%.2d.%.2d" /* e.g. 01.01.01.01.01.01 */
  1934. X#define DIFF "/usr/local/bin/diff" /* name of 'diff' program */
  1935. X#define DIFF3 "/usr/local/bin/diff3" /* name of 'diff3' program */
  1936. X#define DIFF3_BIN 1 /* Is diff3 user-visible (not the /usr/lib auxiliary)?  */
  1937. X#define DIFF_FLAGS , "-an" /* Make diff output suitable for RCS.  */
  1938. X#define DIFF_L 1 /* Does diff -L work? */
  1939. X#define DIFF_SUCCESS 0 /* DIFF status if no differences are found */
  1940. X#define DIFF_FAILURE 1 /* DIFF status if differences are found */
  1941. X#define DIFF_TROUBLE 2 /* DIFF status if trouble */
  1942. X#define ED "/bin/ed" /* name of 'ed' program (used only if !DIFF3_BIN) */
  1943. X#define MERGE "/usr/local/bin/merge" /* name of 'merge' program */
  1944. X#define TMPDIR "/tmp" /* default directory for temporary files */
  1945. X#define SLASH '/' /* principal pathname separator */
  1946. X#define SLASHes '/' /* `case SLASHes:' labels all pathname separators */
  1947. X#define isSLASH(c) ((c) == SLASH) /* Is arg a pathname separator?  */
  1948. X#define ROOTPATH(p) isSLASH((p)[0]) /* Is p an absolute pathname?  */
  1949. X#define X_DEFAULT ",v/" /* default value for -x option */
  1950. X#define DIFF_ABSOLUTE 1 /* Is ROOTPATH(DIFF) true?  */
  1951. X#define ALL_ABSOLUTE 1 /* Are all subprograms absolute pathnames?  */
  1952. X#define SENDMAIL "/bin/mail" /* how to send mail */
  1953. X#define TZ_must_be_set 0 /* Must TZ be set for gmtime() to work?  */
  1954. X
  1955. X
  1956. X
  1957. X/* Adjust the following declarations as needed.  */
  1958. X
  1959. X
  1960. X#if __GNUC__ && !__STRICT_ANSI__
  1961. X#    define exiting volatile /* GCC extension: function cannot return */
  1962. X#else
  1963. X#    define exiting
  1964. X#endif
  1965. X
  1966. X#if has_ftruncate
  1967. X    int ftruncate P((int,off_t));
  1968. X#endif
  1969. X
  1970. X/* <sys/mman.h> */
  1971. X#if has_madvise
  1972. X    int madvise P((caddr_t,size_t,int));
  1973. X#endif
  1974. X#if has_mmap
  1975. X    caddr_t mmap P((caddr_t,size_t,int,int,int,off_t));
  1976. X    int munmap P((caddr_t,size_t));
  1977. X#endif
  1978. X
  1979. X
  1980. X/* Posix (ISO/IEC 9945-1: 1990 / IEEE Std 1003.1-1990) */
  1981. X/* These definitions are for the benefit of non-Posix hosts, and */
  1982. X/* Posix hosts that have Standard C compilers but traditional include files.  */
  1983. X/* Unfortunately, mixed-up hosts are all too common.  */
  1984. X
  1985. X/* <fcntl.h> */
  1986. X#ifdef F_DUPFD
  1987. X    int fcntl P((int,int,...));
  1988. X#else
  1989. X    int dup2 P((int,int));
  1990. X#endif
  1991. X#ifndef O_BINARY /* some non-Posix hosts need O_BINARY */
  1992. X#    define O_BINARY 0 /* no effect on Posix */
  1993. X#endif
  1994. X#ifdef O_CREAT
  1995. X#    define open_can_creat 1
  1996. X#else
  1997. X#    define open_can_creat 0
  1998. X#    define O_RDONLY 0
  1999. X#    define O_WRONLY 1
  2000. X#    define O_RDWR 2
  2001. X#    define O_CREAT 01000
  2002. X#    define O_TRUNC 02000
  2003. X    int creat P((char const*,mode_t));
  2004. X#endif
  2005. X#ifndef O_EXCL
  2006. X#    define O_EXCL 0
  2007. X#endif
  2008. X
  2009. X/* <pwd.h> */
  2010. X#if has_getpwuid
  2011. X    struct passwd *getpwuid P((uid_t));
  2012. X#endif
  2013. X
  2014. X/* <signal.h> */
  2015. X#if has_sigaction
  2016. X    int sigaction P((int,struct sigaction const*,struct sigaction*));
  2017. X    int sigaddset P((sigset_t*,int));
  2018. X    int sigemptyset P((sigset_t*));
  2019. X#else
  2020. X#if has_sigblock
  2021. X    /* BSD */
  2022. X    int sigblock P((int));
  2023. X    int sigmask P((int));
  2024. X    int sigsetmask P((int));
  2025. X#endif
  2026. X#endif
  2027. X
  2028. X/* <stdio.h> */
  2029. XFILE *fdopen P((int,char const*));
  2030. int fileno P((FILE*));
  2031. X
  2032. X/* <sys/stat.h> */
  2033. int chmod P((char const*,mode_t));
  2034. int fstat P((int,struct stat*));
  2035. int stat P((char const*,struct stat*));
  2036. mode_t umask P((mode_t));
  2037. X#if has_fchmod
  2038. X    int fchmod P((int,mode_t));
  2039. X#endif
  2040. X#ifndef S_IRUSR
  2041. X#    ifdef S_IREAD
  2042. X#        define S_IRUSR S_IREAD
  2043. X#    else
  2044. X#        define S_IRUSR 0400
  2045. X#    endif
  2046. X#    ifdef S_IWRITE
  2047. X#        define S_IWUSR S_IWRITE
  2048. X#    else
  2049. X#        define S_IWUSR (S_IRUSR/2)
  2050. X#    endif
  2051. X#endif
  2052. X#ifndef S_IRGRP
  2053. X#    if has_getuid
  2054. X#        define S_IRGRP (S_IRUSR / 0010)
  2055. X#        define S_IWGRP (S_IWUSR / 0010)
  2056. X#        define S_IROTH (S_IRUSR / 0100)
  2057. X#        define S_IWOTH (S_IWUSR / 0100)
  2058. X#    else
  2059. X        /* single user OS -- not Posix or Unix */
  2060. X#        define S_IRGRP 0
  2061. X#        define S_IWGRP 0
  2062. X#        define S_IROTH 0
  2063. X#        define S_IWOTH 0
  2064. X#    endif
  2065. X#endif
  2066. X#ifndef S_ISREG
  2067. X#    define S_ISREG(n) (((n) & S_IFMT) == S_IFREG)
  2068. X#endif
  2069. X
  2070. X/* <sys/wait.h> */
  2071. X#if has_wait
  2072. X    pid_t wait P((int*));
  2073. X#endif
  2074. X#ifndef WEXITSTATUS
  2075. X#    define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
  2076. X#    undef WIFEXITED /* Avoid 4.3BSD incompatibility with Posix.  */
  2077. X#endif
  2078. X#ifndef WIFEXITED
  2079. X#    define WIFEXITED(stat_val) (!((stat_val) & 255))
  2080. X#endif
  2081. X
  2082. X/* <unistd.h> */
  2083. char *getlogin P((void));
  2084. int close P((int));
  2085. int isatty P((int));
  2086. int link P((char const*,char const*));
  2087. int open P((char const*,int,...));
  2088. int unlink P((char const*));
  2089. X/* int _filbuf P((FILE*)); *//* keeps lint quiet in traditional C */
  2090. X/* int _flsbuf P((int,FILE*)); *//* keeps lint quiet in traditional C */
  2091. long pathconf P((char const*,int));
  2092. ssize_t write P((int,void const*,size_t));
  2093. X#ifndef STDIN_FILENO
  2094. X#    define STDIN_FILENO 0
  2095. X#    define STDOUT_FILENO 1
  2096. X#    define STDERR_FILENO 2
  2097. X#endif
  2098. X#if has_fork
  2099. X#    if !has_vfork
  2100. X#        undef vfork
  2101. X#        define vfork fork
  2102. X#    endif
  2103. X    pid_t vfork P((void)); /* vfork is nonstandard but faster */
  2104. X#endif
  2105. X#if has_getcwd || !has_getwd
  2106. X    char *getcwd P((char*,size_t));
  2107. X#else
  2108. X    char *getwd P((char*));
  2109. X#endif
  2110. X#if has_getuid
  2111. X    uid_t getuid P((void));
  2112. X#endif
  2113. X#if has_readlink
  2114. X    ssize_t readlink P((char const*,char*,size_t)); /* BSD; not standard yet */
  2115. X#endif
  2116. X#if has_setuid
  2117. X#    if !has_seteuid
  2118. X#        undef seteuid
  2119. X#        define seteuid setuid
  2120. X#    endif
  2121. X    int seteuid P((uid_t));
  2122. X    uid_t geteuid P((void));
  2123. X#endif
  2124. X#if has_spawn
  2125. X    int spawnv P((int,char const*,char*const*));
  2126. X#    if ALL_ABSOLUTE
  2127. X#        define spawn_RCS spawnv
  2128. X#    else
  2129. X#        define spawn_RCS spawnvp
  2130. X        int spawnvp P((int,char const*,char*const*));
  2131. X#    endif
  2132. X#else
  2133. X    int execv P((char const*,char*const*));
  2134. X#    if ALL_ABSOLUTE
  2135. X#        define exec_RCS execv
  2136. X#    else
  2137. X#        define exec_RCS execvp
  2138. X        int execvp P((char const*,char*const*));
  2139. X#    endif
  2140. X#endif
  2141. X
  2142. X/* utime.h */
  2143. int utime P((char const*,struct utimbuf const*));
  2144. X
  2145. X
  2146. X/* Standard C library */
  2147. X/* These definitions are for the benefit of hosts that have */
  2148. X/* traditional C include files, possibly with Standard C compilers.  */
  2149. X/* Unfortunately, mixed-up hosts are all too common.  */
  2150. X
  2151. X/* <errno.h> */
  2152. extern int errno;
  2153. X
  2154. X/* <limits.h> */
  2155. X#ifndef ULONG_MAX
  2156. X    /* This does not work in #ifs, but it's good enough for us.  */
  2157. X#    define ULONG_MAX ((unsigned long)-1)
  2158. X#endif
  2159. X
  2160. X/* <signal.h> */
  2161. X#if has_signal
  2162. X    signal_type (*signal P((int,signal_type(*)signal_args)))signal_args;
  2163. X#endif
  2164. X
  2165. X/* <stdio.h> */
  2166. XFILE *fopen P((char const*,char const*));
  2167. fread_type fread P((void*,freadarg_type,freadarg_type,FILE*));
  2168. fread_type fwrite P((void const*,freadarg_type,freadarg_type,FILE*));
  2169. int fclose P((FILE*));
  2170. int feof P((FILE*));
  2171. int ferror P((FILE*));
  2172. int fflush P((FILE*));
  2173. int fprintf P((FILE*,char const*,...));
  2174. int fputs P((char const*,FILE*));
  2175. int fseek P((FILE*,long,int));
  2176. int printf P((char const*,...));
  2177. int rename P((char const*,char const*));
  2178. int sprintf P((char*,char const*,...));
  2179. long ftell P((FILE*));
  2180. void clearerr P((FILE*));
  2181. void perror P((char const*));
  2182. X#ifndef L_tmpnam
  2183. X#    define L_tmpnam 32 /* power of 2 > sizeof("/usr/tmp/xxxxxxxxxxxxxxx") */
  2184. X#endif
  2185. X#ifndef SEEK_SET
  2186. X#    define SEEK_SET 0
  2187. X#endif
  2188. X#if has_mktemp
  2189. X    char *mktemp P((char*)); /* traditional */
  2190. X#else
  2191. X    char *tmpnam P((char*));
  2192. X#endif
  2193. X#if has_vfprintf
  2194. X    int vfprintf P((FILE*,char const*,va_list));
  2195. X#else
  2196. X#if has__doprintf
  2197. X    void _doprintf P((FILE*,char const*,va_list)); /* Minix */
  2198. X#else
  2199. X    void _doprnt P((char const*,va_list,FILE*)); /* BSD */
  2200. X#endif
  2201. X#endif
  2202. X
  2203. X/* <stdlib.h> */
  2204. char *getenv P((char const*));
  2205. exiting void _exit P((int));
  2206. exiting void exit P((int));
  2207. malloc_type malloc P((size_t));
  2208. malloc_type realloc P((malloc_type,size_t));
  2209. void free P((malloc_type));
  2210. X#ifndef EXIT_FAILURE
  2211. X#    define EXIT_FAILURE 1
  2212. X#endif
  2213. X#ifndef EXIT_SUCCESS
  2214. X#    define EXIT_SUCCESS 0
  2215. X#endif
  2216. X#if !has_fork && !has_spawn
  2217. X    int system P((char const*));
  2218. X#endif
  2219. X
  2220. X/* <string.h> */
  2221. char *strcpy P((char*,char const*));
  2222. char *strchr P((char const*,int));
  2223. char *strrchr P((char const*,int));
  2224. int memcmp P((void const*,void const*,size_t));
  2225. int strcmp P((char const*,char const*));
  2226. size_t strlen P((char const*));
  2227. void *memcpy P((void*,void const*,size_t));
  2228. X#if has_memmove
  2229. X    void *memmove P((void*,void const*,size_t));
  2230. X#endif
  2231. X
  2232. X/* <time.h> */
  2233. time_t time P((time_t*));
  2234. END_OF_FILE
  2235. if test 14899 -ne `wc -c <'src/conf.heg'`; then
  2236.     echo shar: \"'src/conf.heg'\" unpacked with wrong size!
  2237. fi
  2238. # end of 'src/conf.heg'
  2239. fi
  2240. if test -f 'src/rcsgen.c' -a "${1}" != "-c" ; then 
  2241.   echo shar: Will not clobber existing file \"'src/rcsgen.c'\"
  2242. else
  2243. echo shar: Extracting \"'src/rcsgen.c'\" \(11606 characters\)
  2244. sed "s/^X//" >'src/rcsgen.c' <<'END_OF_FILE'
  2245. X/*
  2246. X *                     RCS revision generation
  2247. X */
  2248. X
  2249. X/* Copyright (C) 1982, 1988, 1989 Walter Tichy
  2250. X   Copyright 1990, 1991 by Paul Eggert
  2251. X   Distributed under license by the Free Software Foundation, Inc.
  2252. X
  2253. This file is part of RCS.
  2254. X
  2255. RCS is free software; you can redistribute it and/or modify
  2256. it under the terms of the GNU General Public License as published by
  2257. the Free Software Foundation; either version 2, or (at your option)
  2258. any later version.
  2259. X
  2260. RCS is distributed in the hope that it will be useful,
  2261. but WITHOUT ANY WARRANTY; without even the implied warranty of
  2262. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  2263. GNU General Public License for more details.
  2264. X
  2265. You should have received a copy of the GNU General Public License
  2266. along with RCS; see the file COPYING.  If not, write to
  2267. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  2268. X
  2269. Report problems and direct all questions to:
  2270. X
  2271. X    rcs-bugs@cs.purdue.edu
  2272. X
  2273. X*/
  2274. X
  2275. X
  2276. X
  2277. X/* $Log: rcsgen.c,v $
  2278. X * Revision 5.10  1991/10/07  17:32:46  eggert
  2279. X * Fix log bugs, e.g. ci -t/dev/null when has_mmap.
  2280. X *
  2281. X * Revision 5.9  1991/09/10  22:15:46  eggert
  2282. X * Fix test for redirected stdin.
  2283. X *
  2284. X * Revision 5.8  1991/08/19  03:13:55  eggert
  2285. X * Add piece tables.  Tune.
  2286. X *
  2287. X * Revision 5.7  1991/04/21  11:58:24  eggert
  2288. X * Add MS-DOS support.
  2289. X *
  2290. X * Revision 5.6  1990/12/27  19:54:26  eggert
  2291. X * Fix bug: rcs -t inserted \n, making RCS file grow.
  2292. X *
  2293. X * Revision 5.5  1990/12/04  05:18:45  eggert
  2294. X * Use -I for prompts and -q for diagnostics.
  2295. X *
  2296. X * Revision 5.4  1990/11/01  05:03:47  eggert
  2297. X * Add -I and new -t behavior.  Permit arbitrary data in logs.
  2298. X *
  2299. X * Revision 5.3  1990/09/21  06:12:43  hammer
  2300. X * made putdesc() treat stdin the same whether or not it was from a terminal
  2301. X * by making it recognize that a single '.' was then end of the
  2302. X * description always
  2303. X *
  2304. X * Revision 5.2  1990/09/04  08:02:25  eggert
  2305. X * Fix `co -p1.1 -ko' bug.  Standardize yes-or-no procedure.
  2306. X *
  2307. X * Revision 5.1  1990/08/29  07:14:01  eggert
  2308. X * Clean old log messages too.
  2309. X *
  2310. X * Revision 5.0  1990/08/22  08:12:52  eggert
  2311. X * Remove compile-time limits; use malloc instead.
  2312. X * Ansify and Posixate.
  2313. X *
  2314. X * Revision 4.7  89/05/01  15:12:49  narten
  2315. X * changed copyright header to reflect current distribution rules
  2316. X * 
  2317. X * Revision 4.6  88/08/28  14:59:10  eggert
  2318. X * Shrink stdio code size; allow cc -R; remove lint; isatty() -> ttystdin()
  2319. X * 
  2320. X * Revision 4.5  87/12/18  11:43:25  narten
  2321. X * additional lint cleanups, and a bug fix from the 4.3BSD version that
  2322. X * keeps "ci" from sticking a '\377' into the description if you run it
  2323. X * with a zero-length file as the description. (Guy Harris)
  2324. X * 
  2325. X * Revision 4.4  87/10/18  10:35:10  narten
  2326. X * Updating version numbers. Changes relative to 1.1 actually relative to
  2327. X * 4.2
  2328. X * 
  2329. X * Revision 1.3  87/09/24  13:59:51  narten
  2330. X * Sources now pass through lint (if you ignore printf/sprintf/fprintf 
  2331. X * warnings)
  2332. X * 
  2333. X * Revision 1.2  87/03/27  14:22:27  jenkins
  2334. X * Port to suns
  2335. X * 
  2336. X * Revision 4.2  83/12/02  23:01:39  wft
  2337. X * merged 4.1 and 3.3.1.1 (clearerr(stdin)).
  2338. X * 
  2339. X * Revision 4.1  83/05/10  16:03:33  wft
  2340. X * Changed putamin() to abort if trying to reread redirected stdin.
  2341. X * Fixed getdesc() to output a prompt on initial newline.
  2342. X * 
  2343. X * Revision 3.3.1.1  83/10/19  04:21:51  lepreau
  2344. X * Added clearerr(stdin) for re-reading description from stdin.
  2345. X * 
  2346. X * Revision 3.3  82/11/28  21:36:49  wft
  2347. X * 4.2 prerelease
  2348. X * 
  2349. X * Revision 3.3  82/11/28  21:36:49  wft
  2350. X * Replaced ferror() followed by fclose() with ffclose().
  2351. X * Putdesc() now suppresses the prompts if stdin
  2352. X * is not a terminal. A pointer to the current log message is now
  2353. X * inserted into the corresponding delta, rather than leaving it in a
  2354. X * global variable.
  2355. X *
  2356. X * Revision 3.2  82/10/18  21:11:26  wft
  2357. X * I added checks for write errors during editing, and improved
  2358. X * the prompt on putdesc().
  2359. X *
  2360. X * Revision 3.1  82/10/13  15:55:09  wft
  2361. X * corrected type of variables assigned to by getc (char --> int)
  2362. X */
  2363. X
  2364. X
  2365. X
  2366. X
  2367. X#include "rcsbase.h"
  2368. X
  2369. libId(genId, "$Id: rcsgen.c,v 5.10 1991/10/07 17:32:46 eggert Exp $")
  2370. X
  2371. int interactiveflag;  /* Should we act as if stdin is a tty?  */
  2372. struct buf curlogbuf;  /* buffer for current log message */
  2373. X
  2374. enum stringwork { enter, copy, edit, expand, edit_expand };
  2375. static void scandeltatext P((struct hshentry*,enum stringwork,int));
  2376. X
  2377. X
  2378. X
  2379. X
  2380. X    char const *
  2381. buildrevision(deltas, target, outfile, expandflag)
  2382. X    struct hshentries const *deltas;
  2383. X    struct hshentry *target;
  2384. X    FILE *outfile;
  2385. X    int expandflag;
  2386. X/* Function: Generates the revision given by target
  2387. X * by retrieving all deltas given by parameter deltas and combining them.
  2388. X * If outfile is set, the revision is output to it,
  2389. X * otherwise written into a temporary file.
  2390. X * Temporary files are allocated by maketemp().
  2391. X * if expandflag is set, keyword expansion is performed.
  2392. X * Return nil if outfile is set, the name of the temporary file otherwise.
  2393. X *
  2394. X * Algorithm: Copy initial revision unchanged.  Then edit all revisions but
  2395. X * the last one into it, alternating input and output files (resultfile and
  2396. X * editfile). The last revision is then edited in, performing simultaneous
  2397. X * keyword substitution (this saves one extra pass).
  2398. X * All this simplifies if only one revision needs to be generated,
  2399. X * or no keyword expansion is necessary, or if output goes to stdout.
  2400. X */
  2401. X{
  2402. X    if (deltas->first == target) {
  2403. X                /* only latest revision to generate */
  2404. X        openfcopy(outfile);
  2405. X        scandeltatext(target, expandflag?expand:copy, true);
  2406. X        if (outfile)
  2407. X            return 0;
  2408. X        else {
  2409. X            Ozclose(&fcopy);
  2410. X                        return(resultfile);
  2411. X        }
  2412. X        } else {
  2413. X                /* several revisions to generate */
  2414. X        /* Get initial revision without keyword expansion.  */
  2415. X        scandeltatext(deltas->first, enter, false);
  2416. X        while ((deltas=deltas->rest)->rest) {
  2417. X                        /* do all deltas except last one */
  2418. X            scandeltatext(deltas->first, edit, false);
  2419. X                }
  2420. X        if (expandflag || outfile) {
  2421. X                        /* first, get to beginning of file*/
  2422. X            finishedit((struct hshentry *)nil, outfile, false);
  2423. X                }
  2424. X        scandeltatext(deltas->first, expandflag?edit_expand:edit, true);
  2425. X        finishedit(
  2426. X            expandflag ? deltas->first : (struct hshentry*)nil,
  2427. X            outfile, true
  2428. X        );
  2429. X        if (outfile)
  2430. X            return 0;
  2431. X        Ozclose(&fcopy);
  2432. X        return resultfile;
  2433. X        }
  2434. X}
  2435. X
  2436. X
  2437. X
  2438. X    static void
  2439. scandeltatext(delta, func, needlog)
  2440. X    struct hshentry * delta;
  2441. X    enum stringwork func;
  2442. X    int needlog;
  2443. X/* Function: Scans delta text nodes up to and including the one given
  2444. X * by delta. For the one given by delta, the log message is saved into
  2445. X * delta->log if needlog is set; func specifies how to handle the text.
  2446. X * Assumes the initial lexeme must be read in first.
  2447. X * Does not advance nexttok after it is finished.
  2448. X */
  2449. X{
  2450. X    struct hshentry const *nextdelta;
  2451. X    struct cbuf cb;
  2452. X
  2453. X        for (;;) {
  2454. X        if (eoflex())
  2455. X            fatserror("can't find delta for revision %s", delta->num);
  2456. X                nextlex();
  2457. X                if (!(nextdelta=getnum())) {
  2458. X            fatserror("delta number corrupted");
  2459. X                }
  2460. X        getkeystring(Klog);
  2461. X        if (needlog && delta==nextdelta) {
  2462. X            cb = savestring(&curlogbuf);
  2463. X            delta->log = cleanlogmsg(curlogbuf.string, cb.size);
  2464. X                } else {readstring();
  2465. X                }
  2466. X                nextlex();
  2467. X        while (nexttok==ID && strcmp(NextString,Ktext)!=0)
  2468. X            ignorephrase();
  2469. X        getkeystring(Ktext);
  2470. X
  2471. X        if (delta==nextdelta)
  2472. X            break;
  2473. X        readstring(); /* skip over it */
  2474. X
  2475. X    }
  2476. X    switch (func) {
  2477. X        case enter: enterstring(); break;
  2478. X        case copy: copystring(); break;
  2479. X        case expand: xpandstring(delta); break;
  2480. X        case edit: editstring((struct hshentry *)nil); break;
  2481. X        case edit_expand: editstring(delta); break;
  2482. X    }
  2483. X}
  2484. X
  2485. X    struct cbuf
  2486. cleanlogmsg(m, s)
  2487. X    char *m;
  2488. X    size_t s;
  2489. X{
  2490. X    register char *t = m;
  2491. X    register char const *f = t;
  2492. X    struct cbuf r;
  2493. X    while (s) {
  2494. X        --s;
  2495. X        if ((*t++ = *f++) == '\n')
  2496. X        while (m < --t)
  2497. X            if (t[-1]!=' ' && t[-1]!='\t') {
  2498. X            *t++ = '\n';
  2499. X            break;
  2500. X            }
  2501. X    }
  2502. X    while (m < t  &&  (t[-1]==' ' || t[-1]=='\t' || t[-1]=='\n'))
  2503. X        --t;
  2504. X    r.string = m;
  2505. X    r.size = t - m;
  2506. X    return r;
  2507. X}
  2508. X
  2509. X
  2510. int ttystdin()
  2511. X{
  2512. X    static int initialized;
  2513. X    if (!initialized) {
  2514. X        if (!interactiveflag)
  2515. X            interactiveflag = isatty(STDIN_FILENO);
  2516. X        initialized = true;
  2517. X    }
  2518. X    return interactiveflag;
  2519. X}
  2520. X
  2521. X    int
  2522. getcstdin()
  2523. X{
  2524. X    register FILE *in;
  2525. X    register int c;
  2526. X
  2527. X    in = stdin;
  2528. X    if (feof(in) && ttystdin())
  2529. X        clearerr(in);
  2530. X    c = getc(in);
  2531. X    if (c < 0) {
  2532. X        testIerror(in);
  2533. X        if (feof(in) && ttystdin())
  2534. X            afputc('\n',stderr);
  2535. X    }
  2536. X    return c;
  2537. X}
  2538. X
  2539. X#if has_prototypes
  2540. X    int
  2541. yesorno(int default_answer, char const *question, ...)
  2542. X#else
  2543. X        /*VARARGS2*/ int
  2544. X    yesorno(default_answer, question, va_alist)
  2545. X        int default_answer; char const *question; va_dcl
  2546. X#endif
  2547. X{
  2548. X    va_list args;
  2549. X    register int c, r;
  2550. X    if (!quietflag && ttystdin()) {
  2551. X        oflush();
  2552. X        vararg_start(args, question);
  2553. X        fvfprintf(stderr, question, args);
  2554. X        va_end(args);
  2555. X        eflush();
  2556. X        r = c = getcstdin();
  2557. X        while (c!='\n' && !feof(stdin))
  2558. X            c = getcstdin();
  2559. X        if (r=='y' || r=='Y')
  2560. X            return true;
  2561. X        if (r=='n' || r=='N')
  2562. X            return false;
  2563. X    }
  2564. X    return default_answer;
  2565. X}
  2566. X
  2567. X
  2568. X    void
  2569. putdesc(textflag, textfile)
  2570. X    int textflag;
  2571. X    char *textfile;
  2572. X/* Function: puts the descriptive text into file frewrite.
  2573. X * if finptr && !textflag, the text is copied from the old description.
  2574. X * Otherwise, if the textfile!=nil, the text is read from that
  2575. X * file, or from stdin, if textfile==nil.
  2576. X * A textfile with a leading '-' is treated as a string, not a file name.
  2577. X * If finptr, the old descriptive text is discarded.
  2578. X * Always clears foutptr.
  2579. X */
  2580. X{
  2581. X    static struct buf desc;
  2582. X    static struct cbuf desclean;
  2583. X
  2584. X    register FILE *txt;
  2585. X    register int c;
  2586. X    register FILE * frew;
  2587. X    register char *p;
  2588. X    register size_t s;
  2589. X    char const *plim;
  2590. X
  2591. X    frew = frewrite;
  2592. X    if (finptr && !textflag) {
  2593. X                /* copy old description */
  2594. X        aprintf(frew, "\n\n%s%c", Kdesc, nextc);
  2595. X        foutptr = frewrite;
  2596. X        getdesc(false);
  2597. X        foutptr = 0;
  2598. X        } else {
  2599. X        foutptr = 0;
  2600. X                /* get new description */
  2601. X        if (finptr) {
  2602. X                        /*skip old description*/
  2603. X            getdesc(false);
  2604. X                }
  2605. X        aprintf(frew,"\n\n%s\n%c",Kdesc,SDELIM);
  2606. X        if (!textfile)
  2607. X            desclean = getsstdin(
  2608. X                "t-", "description",
  2609. X                "NOTE: This is NOT the log message!\n", &desc
  2610. X            );
  2611. X        else if (!desclean.string) {
  2612. X            if (*textfile == '-') {
  2613. X                p = textfile + 1;
  2614. X                s = strlen(p);
  2615. X            } else {
  2616. X                if (!(txt = fopen(textfile, "r")))
  2617. X                    efaterror(textfile);
  2618. X                bufalloc(&desc, 1);
  2619. X                p = desc.string;
  2620. X                plim = p + desc.size;
  2621. X                for (;;) {
  2622. X                    if ((c=getc(txt)) < 0) {
  2623. X                        testIerror(txt);
  2624. X                        if (feof(txt))
  2625. X                            break;
  2626. X                    }
  2627. X                    if (plim <= p)
  2628. X                        p = bufenlarge(&desc, &plim);
  2629. X                    *p++ = c;
  2630. X                }
  2631. X                if (fclose(txt) != 0)
  2632. X                    Ierror();
  2633. X                s = p - desc.string;
  2634. X                p = desc.string;
  2635. X            }
  2636. X            desclean = cleanlogmsg(p, s);
  2637. X        }
  2638. X        putstring(frew, false, desclean, true);
  2639. X        aputc('\n', frew);
  2640. X        }
  2641. X}
  2642. X
  2643. X    struct cbuf
  2644. getsstdin(option, name, note, buf)
  2645. X    char const *option, *name, *note;
  2646. X    struct buf *buf;
  2647. X{
  2648. X    register int c;
  2649. X    register char *p;
  2650. X    register size_t i;
  2651. X    register int tty = ttystdin();
  2652. X
  2653. X    if (tty)
  2654. X        aprintf(stderr,
  2655. X        "enter %s, terminated with single '.' or end of file:\n%s>> ",
  2656. X        name, note
  2657. X        );
  2658. X    else if (feof(stdin))
  2659. X        faterror("can't reread redirected stdin for %s; use -%s<%s>",
  2660. X        name, option, name
  2661. X        );
  2662. X    
  2663. X    for (
  2664. X       i = 0,  p = 0;
  2665. X       c = getcstdin(),  !feof(stdin);
  2666. X       bufrealloc(buf, i+1),  p = buf->string,  p[i++] = c
  2667. X    )
  2668. X        if (c == '\n')
  2669. X            if (i  &&  p[i-1]=='.'  &&  (i==1 || p[i-2]=='\n')) {
  2670. X                /* Remove trailing '.'.  */
  2671. X                --i;
  2672. X                break;
  2673. X            } else if (tty)
  2674. X                aputs(">> ", stderr);
  2675. X    return cleanlogmsg(p, i);
  2676. X}
  2677. END_OF_FILE
  2678. if test 11606 -ne `wc -c <'src/rcsgen.c'`; then
  2679.     echo shar: \"'src/rcsgen.c'\" unpacked with wrong size!
  2680. fi
  2681. # end of 'src/rcsgen.c'
  2682. fi
  2683. echo shar: End of archive 3 \(of 11\).
  2684. cp /dev/null ark3isdone
  2685. MISSING=""
  2686. for I in 1 2 3 4 5 6 7 8 9 10 11 ; do
  2687.     if test ! -f ark${I}isdone ; then
  2688.     MISSING="${MISSING} ${I}"
  2689.     fi
  2690. done
  2691. if test "${MISSING}" = "" ; then
  2692.     echo You have unpacked all 11 archives.
  2693.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2694. else
  2695.     echo You still need to unpack the following archives:
  2696.     echo "        " ${MISSING}
  2697. fi
  2698. ##  End of shell archive.
  2699. exit 0
  2700.